Suppose I want to create a dummy switch for HomeKit using an app.
I run the app for the first time, the app registers itself as a dummy switch and all accessories see the app as an OFF switch.
The following day, I run the app again and turn the dummy switch ON. All accessories that were monitoring the status of that switch, adjusted themselves accordingly, run their automations and so on.
Can an app do that in iOS, macOS, iPadOS, watchOS, etc.?
If so, can you point me in the right direction?
There is no need to act as a dummy switch. What you describe might be possible using Scenes in the Home app, meaning no code at all. It is definitely possible to directly adjust these devices using HomeKit (the developer kit, not the app). That will be possible on all platforms, but you might have to use Mac Catalyst.