A method to understand in http if a light is on

I need a method to public the status of my device in Http, and give them to other gateway using GET or POST http request.
I have found a Mini Webserver in the APP catalogue, and with this app is very simple to create a GET to start a flow. But now i need the possibility to know the status of every device with the same method.
Is it possible?

If you want to publish the state of every device on your Homey, you probably have to start looking into Homeyscript.

And before that think twice: Do I really need status of every device and with every request?

Actually, the allways/every is quite resource consuming approach. Little bit better, if

  1. Select required devices only
  2. Keep track of changes - during updates check/give only a changed statuses. The best, if server pushes (not client pulls) the change at time it happens.

And even better,
You already have it.
It is called the API of Homey,
With one http(s) get you get the status from one or all devices. Nice formatted in a json.

Yes!.. and also no :face_with_raised_eyebrow:
You described a good (and may-be on some cases only) solution. But the problem for that is a little word “when”. I mean, when You get in real timescale the change. Because of that i’d prefer that “the source of changes” (Athom itself) is pushing the message about change.
Also… the problem, i see with nice formatted JSON (yes, again, this is working solution) is, that the all-in-one JSON itself is a loooooong datastructure (requires power for composing/decomposing and also network bandwith).

Just for example some of possibilities, i had seen in other solutions:

  1. When someone is asking some status questions… then during some amount of time all next changes are pushed to this IP address specified port. It’s used on Yamaha receivers
  2. There is possibility to ask from source “all changes between timestamps/from timestamp”. It’s giving a change list (and what’s exactly changed) and a final timestamp for the list. So, next poll time just “changes from this timestamp” are required to ask. Used for example in Fibaro protocols.

So, from my point of view, and if i’d be “The Supreme Being” - then may-be use something like server push for such “constantly follow the changes” protocol. Hmm, or do we have it already in API (sorry, i’m quite green in Homey, jus come over from another system(s)).

The MQTT Hub app published all device changes realtime over MQTT.

1 Like

All of them are good solution.

  • The API needs jason, not implemented in the devise that i wanna use
  • maybe i have found a mqtt client very tiny to install in my device. But i’m a novice with mqtt. Is there a message to know the device status , using mqtt APP in homey (no other external installation)?
    and a message that refresh all the device status?

Thanks

Can You uncover Your military secret, what kind of device You using? - or must You kill us after the tell :wink:

:)))
it’s a industrial that use 8266 but it’s not possible to use all features. It’s a bet to study something different.
But it has a proprietary software for the programming that is very usefull and can manage the mcu using http (simple http).
Of course it is a bet to understand the potentiality of some app

But then… i think, the first point to start is attempt to … mess with a REST API ?
Not very well documented (especially the token management - initial token acquiring; token refreshing) but actually seems doable. If little bit more time available and little bit more study is acceptable, then may-be WEB-hooks.

PS. You told, no JSON in system, but this is not the biggest problem, if You have there some string grinding mechanisms - or even the byte-2-byte processing. Yep, this is not lazy-man business.