rdnat
(Rudy)
October 7, 2018, 5:36pm
1
Hello, I have a sonoff with Tasmota firmware and I have configure with this items:
Switch SonoffRoom11_Unreach "Room 11 unreachable" <siren> (Unreach_Group) { mqtt="<[DomoBroker:tele/sonoff-Room-11/LWT:state:MAP(unreach.map)]" }
How can test the LWT state? How can I simulate an offline state?
thanks
vzorglub
(Vincent Regaud)
October 7, 2018, 6:51pm
2
In a rule:
I don’t know what you map file looks like but it would go something like this:
rule "LWT"
when
Item SonoffRoom11_Unreach changed
then
if (SonoffRoom11_Unreach.state == OFF) {
// Do something
}
end
By using the REST API
rdnat
(Rudy)
October 7, 2018, 6:58pm
3
I change the question, how can check if my devices are correctly connected? LWT is a correct way? Can you suggest me the API to use for simulate disconnection (exactly command)? Actually I use only the console…I’m beginner sorry…
vzorglub
(Vincent Regaud)
October 7, 2018, 7:31pm
5
The REST API
As many of you are aware, there is a thread written by me and others with a bunch of generic Rules DSL Design Patterns. In keeping with the new thrust to populate the Tutorials & Example category, plus that thread is really long, I will make all future Design Patterns their own thread.
Problem Statement
Many sensors report status to openHAB periodically (e.g. temperature sensor) or unpredictably (e.g. motion sensors) and a subset of these sensors do not have a built in way for openHAB to quer…
Or the console
With runtime commands
rlkoshak
(Rich Koshak)
October 8, 2018, 4:29pm
6
Since it’s just a Sonoff, just unplug it. After a few seconds or so the LWT message should be generated.
rdnat
(Rudy)
October 9, 2018, 5:30pm
7
I try it but it doesn’t work…I have created an item in habpanel with type Switch and String but both not update if I switched off the sonoff
rlkoshak
(Rich Koshak)
October 9, 2018, 6:51pm
8
Have you configured the Sonoff to use the LWT?
Have you confirmed the topic configured on the Sonoff exactly matches the one on the Item?
Use a third party MQTT client like MQTT.fx to subscribe to that topic and see if a message is being published and OH is just not getting them.
rdnat
(Rudy)
October 9, 2018, 7:01pm
9
Sure! With MQTT.fx is see offline message but it not receive to my items and change the status…maybe I wrong the type of items?
rdnat
(Rudy)
October 9, 2018, 7:04pm
10
Have you configured the Sonoff to use the LWT?
There are some step to do to enable it?
rlkoshak
(Rich Koshak)
October 9, 2018, 7:40pm
11
If you are getting the Offline message to that topic then the LWT is already configured.
Do you see anything in the logs? Perhaps there is a problem with unreach.map. If it isn’t returning ON for Online and OFF for Offline then it isn’t returning a valid state for a Switch Item.
Always look in the logs for errors.
rdnat
(Rudy)
October 9, 2018, 8:54pm
12
I don’t have unreach.map how it should be configured?
rlkoshak
(Rich Koshak)
October 9, 2018, 9:34pm
13
Make sure to install the Map transform.
rdnat
(Rudy)
October 9, 2018, 9:39pm
14
It wasn’t. I have just installed now. I have to configure it?
rdnat
(Rudy)
October 9, 2018, 9:41pm
16
It’s seems work now! Before appear NULL now OFF and it’s correct! Before I use network ping as workround…