-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example of PUB messages required to display/trigger Android app? #92
Comments
Uh yes, thats probably not that obvious when you're not using it since half a year ;) Actually, when you have components that publish some messages according to the conventions in https://github.com/binarybucks/homA/wiki/Interfaces you will have something to play with. When you just have a broker up and running, would that be sufficient for the sake of seeing something?
When you flip a control, the value is published back to Does this meet the definition of "doing something"? If so, I'd put it into a readme so it becomes easier to find. |
Thank you. I think I'm almost there, but not quite: pub="mosquitto_pub -h hippo -r "
${pub} -t /devices/FAN1/controls/Testcontrol1/meta/type -m switch
${pub} -t /devices/FAN1/controls/Testcontrol1 -m 1
${pub} -t /devices/FAN1/controls/Testcontrol2/meta/type -m Text
${pub} -t /devices/FAN1/controls/Testcontrol2 -m "Room ventilator"
${pub} -t /devices/Testdevice2/controls/Testcontrol1/meta/type -m switch
${pub} -t /devices/Testdevice2/controls/Testcontrol1 -m 1
${pub} -t /devices/Testdevice2/meta/name -m "This is a custom name" I do indeed see "FAN1" in the app. Tapping on it shows Testcontrol1 (with a switch), and Testcontrol2 with text "Room ventilator". I run a `mosquitto_sub -t '/devices/#' . When I flick the switch On/Off/On/Off, I see
Must leave now. Will test later. |
I guess you want to toggle the status of FAN1-Testcontrol1? In that case something (ideally the thing that subscribes to /devices/FAN1/controls/Testcontrol1/on to physically switch the physical device on and off) has to publish the value back to /devices/FAN1/controls/Testcontrol1 (note the missing /on). What happens is:
The internal state of that control in the interface is only set to 1 when something echos back the published 1 from /devices/FAN1/controls/Testcontrol1/on to /devices/FAN1/controls/Testcontrol1 to which the interface is subscribed. The reason for this is described in https://github.com/binarybucks/homA/wiki/Interfaces#topics : "The reason for this is to prevent any interface or actor from receiving an echo of their own publish and to just display a changed value if it has been handled successfully by an actor." During development we discovered some nasty side-effects such as infinite publish loops when controls set the same values to which they are subscribed, thus the two topics for each control. |
Sounds obvious, @binarybucks, thank you. Another question: will/does the Android app have the ability to show the switch statuses on the main page? I'm thinking along the lines of
etc. :-) |
I'd really like that and it has been suggested somewhere in the depths of the Google+ Android Design community, but:
I opened the improvement issue #98 for it, in case I got some free time or someone would like to work on it ;-) |
For debugging, it may be useful to document an example of a set of messages which will make the Android app do something ... ;-)
The text was updated successfully, but these errors were encountered: