OpenHausIO / backend

HTTP API for the OpenHaus SmartHome/IoT solution
https://docs.open-haus.io
6 stars 2 forks source link

Add a link between command (params) & states? #501

Closed mStirner closed 1 month ago

mStirner commented 1 month ago

Add a link between params & states? A state could be used to keep track of setted parameters/values.

E.g. Temperature. You set the tempretature via Command parameter in the range of 16-32°C. The command is send to the device, and this "should" temperature is then setted as state.

Then there needs a link between the command "set temperature" & the state temperature.

Originally posted by @mStirner in https://github.com/OpenHausIO/frontend/issues/141#issuecomment-2377773296

mStirner commented 1 month ago

A quick guess how it could be done: command & state alias. If they are both the same, the (can) are linked. Either automatically or with labels:

oh.link[0].state=POWER
oh.link[0].cmd=POWER

-- or --

oh.links[].enabled=POWER

But what then? When commands & states are linked, what now?

mStirner commented 1 month ago

Frontend. No need for actions in the backend.

When there is a state with the same command alias, just display the state value inside the command parameter view as seen in the screenshots above.

In combination with a additional added hidden property, the state can be hidden from the endpoint view but seen as value in the command trigger view.

Originally posted by @mStirner in https://github.com/OpenHausIO/frontend/issues/141#issuecomment-2377898386