I decided to rewrite my Arduino code in order for it to be more compatible with the new MQTT binding. I am still learning the ropes and there seems to be an error that I just cant figure.
My current setup ;
relays.things
Type switch : relay3 "Braai Light" [ stateTopic="homie/megarelay/relay-state/r3", commandTopic="homie/megarelay/relay/r3" ]
so currently the cmnd to switch on the relay can be
1 for on
0 for off
2 for toggle on the topic : homie/megarelay/relay/r3
it will then respond with the state of the relay with
1 for on
0 for off on the topic; homie/megarelay/relay-state/r3
if I switch the relay via the sitemap it turns on but I get the following error ;
2019-01-03 12:59:11.333 [ome.event.ItemCommandEvent] - Item ârelay3â received command OFF
2019-01-03 12:59:11.345 [nt.ItemStatePredictedEvent] - relay3 predicted to become OFF
2019-01-03 12:59:11.359 [vent.ItemStateChangedEvent] - relay3 changed from ON to OFF
2019-01-03 12:59:11.364 [vent.ItemStateChangedEvent] - solarwatt changed from 776.8699951171875 to 742.0
==> /var/log/openhab2/openhab.log <==
2019-01-03 12:59:11.379 [WARN ] [eneric.internal.generic.ChannelState] - Command 'off' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.off
2019-01-03 12:59:11.605 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
Also if I switch the relay externally from the state does update but not via the UI page ( I need to refresh the page to see the state of the relay)
Now I assume that there is a problem with the format of my mqtt topicâs and or the payloads but even if I change it to âonâ / âoffâ instead of 1 and 0 it does not make any difference.
The error in the log is coming from your sitemap. You have an Item on your sitemap displayed with a Text element that doesnât exist.
The warning is because a Switch needs ON or OFF and cannot handle on, or off, or 1, or 0. What ever you changes to convert the 0 to off needs to be adjusted to use OFF.
Thank you for the response David.
I have read through the Homie pages and was under the impression that it was a mqtt structure that was important but I realize that it is quite a bit more involved.
Unfortunately its above my average âcodingâ skills so it will need to be placed on the shelve for now until I have sorted the rest of the System.