Closed Kepete closed 6 years ago
I dind't find the "code" to put the accessory in the "Not Responding" state. Let me to study what about at the link.
I'm using 'mqtt-switch-tasmota' too for basic switches/lighting.
The feature request is all about:
"activityTopic": "tele/sonoff/LWT",
"activityParameter": "Online", <- this one depends on locale
Line 141: https://github.com/MacWyznawca/homebridge-mqtt-switch-tasmota/blob/master/index.js
When mqtt-response != "Online", device is then marked for HomeKit as offline. This behavior dramatically reduces HomeKit querying, when using several devices.
Otherwise all devices, attached to same Homebridge, may become stuck in Home.app at "Updating" state for 15-30 sec.
I'm working around it. Not strictly related to the tamota features but inline with the mqtt lwt feature.
Added Online/Offline detection :
@Kepete Did you finally make a garage door opener based on the device from the tasmota firmware and sensors or other solutions? I am looking for a working solution all the time and I can not find anything. Will you help me? example: wemos d1 mini + relay + reed sensor / pir sensor
@iomax I will check the Online/Offline detection in the weekend :)
@mientki Yes I have a working solution running, very happy with it! Thought it was a little tricky.
I have a NodeMCU v2 flashed with Tasmota, one relay, two reed sensors, temp sensor. The configuration looks like this:
Switch1
and switch2
are the reed sensors for door fully open
or door fully closed
. They need to have relay1 and relay2 also specified, otherwise the Tasmota will not give you a separate MQTT topic. Only the relay3
is an actual relay and is used to open the garage door. Temperature sensor is optional.
Plugin configuration looks like this:
{
"accessory": "mqttgaragedoor",
"name": "Garage door",
"url": "mqtt://x.x.x.x",
"username": "usr",
"password": "pswd",
"caption": "Garage door",
"topics": {
"statusSet": "cmnd/sonoff_garage/POWER3",
"openGet": "stat/sonoff_garage/POWER2",
"openValue": "ON",
"closedGet": "stat/sonoff_garage/POWER1",
"closedValue": "ON"
},
"doorRunInSeconds": "20"
}
As pointed out here before. You still need the doorRunInSeconds
but it updates the state to fully closed or fully open as soon as a switch1 or switch2 hit's ON value.
Make sure when setting up that the values for your reed switches are correct. If not inverse them with Tasmota interface by toggeling ON/OFF.
Should be exactly the same on WeMos. Let me know if you need more help or got it working!
Thank you for a quick and comprehensive answer. If you have any questions, they will write to you. Is there another channel of communication with you? Only GitHub?
@Kepete just a quick check at tasmota wiki but maybe I'd update config in somethings like :
{
"accessory": "mqttgaragedoor",
"name": "Garage door",
"url": "mqtt://x.x.x.x",
"username": "usr",
"password": "pswd",
"caption": "Garage door",
"lwt": "/lwt",
"lwtPayload": "offline",
"topics": {
"statusSet": "cmnd/sonoff_garage/POWER3",
"openGet": "stat/sonoff_garage/POWER2",
"openValue": "ON",
"closedGet": "stat/sonoff_garage/POWER1",
"closedValue": "ON",
"openStatusCmdTopic": "cmnd/sonoff_garage/POWER2",
"closeStatusCmdTopic": "cmnd/sonoff_garage/POWER1"
},
"doorRunInSeconds": "20"
}
@iomax Thanks for pointing out, but actually I don't understand- what for are these needed?
"openStatusCmdTopic": "cmnd/sonoff_garage/POWER2",
"closeStatusCmdTopic": "cmnd/sonoff_garage/POWER1"
@Kepete Does your gateway relay work in pulse mode (pulsetime in tasmota) for example 1 second?
@mientki Oh yes, forgot about that -> Pulsetime3 10
"<open/close>StatusCmdTopic" to "force" a feeback by the remote device about the open/closed state. It will be usefull to keep plugin updated about the door state.
I managed to set the accessory. I can finally tell Siri to open the garage door. :-) Everything works well on the desk. Today I mount everything in the garage. Thank you @Kepete for help. You helped me a lot. I have a question: What are these settings for? How should they be arranged?
"lwt": "OPTIONAL: DOOR OPENER MQTT LAST WILL AND TESTAMENT TOPIC", "lwtPayload": "lwt Payload"
How do you have it set?
"lwt", "lwtPayload" as well, will allow the "not responding" state in the Home(kit) apps in case the "door operator" ( Wemos/Tasmota switch in your case, from my understanding) goes off line.
"lwt": "/lwt",
"lwtPayload": "offline"
should do the work, but I'm unable to check with a Tasmota enviroment so maybe we have to wait one more feedback by @Kepete
will it be correct?
{
"accessory": "mqttgaragedoor",
"name": "Garage door",
"url": "mqtt://192.168.99.170",
"username": "***",
"password": "***",
"caption": "Garage door",
"topics": {
"statusSet": "cmnd/garage/POWER3",
"openGet": "stat/garage/POWER2",
"openValue": "ON",
"closedGet": "stat/garage/POWER1",
"closedValue": "ON",
"openStatusCmdTopic": "cmnd/garage/POWER2",
"closeStatusCmdTopic": "cmnd/garage/POWER1",
"lwt": "tele/garage/LWT",
"lwtPayload": "offline"
},
"doorRunInSeconds": "20"
}
@mientki Happy you got it working, but the real person to thank here is @iomax who implements all these features and fixes to the plugin! 🥇 With the LWT option I recommend to wait a little until we have figured it out. Right now you config is incorrect. Look at the examples posted before.
About the LWT option. I just tested it.
There is a problem at startup of Homebridge. After you start Homebridge the state of the accessory in the home app is "No Response".
To get it working I need to restart the Tasmota device which in return then sends the lwt message Online
and only then the accessory in the app is showed as online.
It sound good but please take care that you must put lwt & lwtPayload at the "main level" ( not in "topic": { ... } )
{
"accessory": "mqttgaragedoor",
"name": "Garage door",
"url": "mqtt://192.168.99.170",
"username": "***",
"password": "***",
"caption": "Garage door",
"lwt": "tele/garage/LWT",
"lwtPayload": "offline",
"topics": {
"statusSet": "cmnd/garage/POWER3",
"openGet": "stat/garage/POWER2",
"openValue": "ON",
"closedGet": "stat/garage/POWER1",
"closedValue": "ON",
"openStatusCmdTopic": "cmnd/garage/POWER2",
"closeStatusCmdTopic": "cmnd/garage/POWER1"
},
"doorRunInSeconds": "20"
}
Please keep me updated about the "lwt". With Home app in foreground, you can try it switching off the Wemos and waiting the "not responding" state till the mqtt timeout ( usually somethings like 60 or 120sec. )
About the LWT option. I just tested it. There is a problem at startup of Homebridge. After you start Homebridge the state of the accessory in the home app is "No Response". Do get it working I need to restart the Tasmota device which in return then sends the lwt message
Online
and only then the accessory in the app is showed as online.
Have you set the "<open/close>StatusCmdTopic" ? It should force a feedback by the device and avoid the need of the restart.
Didn't had these set. Now works perfectly! Thank you a lot for this awesome plugin. It is now in everyday use and since it has been very reliable.
My final working configuration:
{
"accessory": "mqttgaragedoor",
"name": "Garage",
"url": "mqtt://x.x.x.x",
"username": "usr",
"password": "pswd",
"caption": "Garage",
"lwt": "tele/sonoff_test/LWT",
"lwtPayload": "Offline",
"topics": {
"statusSet": "cmnd/sonoff_test/POWER3",
"openGet": "stat/sonoff_test/POWER2",
"openValue": "ON",
"closedGet": "stat/sonoff_test/POWER1",
"closedValue": "ON",
"openStatusCmdTopic": "cmnd/sonoff_test/POWER2",
"closeStatusCmdTopic": "cmnd/sonoff_test/POWER1"
},
"doorRunInSeconds": "20"
},
I'm glad it's working for you and thanks for your feedback :-)
Out of curiosity, instead of "lwt": "tele/sonoff_test/LWT",
have you tried even "lwt" : "/lwt"
without success ?
Just "lwt" : "/lwt"
didn't work for me
OK, thanks.
One more question: What reed sensors do you use? One of my sensors is not working. Could the length of the wire be about 3 m?
Have you thought about using Sonoff RF Bridge + sensors with two codes?
My sensors look like this:
@mientki I had short wires, so I don't know. Easiest would be to check with shorter wire and see if it works.
I came up with an idea. I would like to use this solution to open the barrier in the parking lot.
The barrier is located 50 m away. No sensors can be connected. The barrier is opened from a remote control or a button at home. It covers itself for 30 seconds and automatically closes without additional activities. I thought to create a rule in tasmota to switch power1 and power2 states to the opposite for a specified time.
Principle of operation:
opening time = 4 sec open for = 22 sec closing time = 4 sec total time = 30 sec
power1 = ON barrier closed power2 = ON barrier opened power3 - relay activated for 1 second (pulsetime3 10)
How to create such a rule in tasmota?
I can't help on tasmota side anyway, without the option to get the "realtime" feedback by the barrier, I'd try :
"doorRunInSeconds": 4,
"pauseInSeconds" : 22,
"topics": {
"statusSet": "cmnd/garage/POWER3"
}
Not working :(
{
"accessory": "mqttgaragedoor",
"name": "Szlaban",
"url": "mqtt://192.168.99.170",
"username": "",
"password": "",
"caption": "Szlaban",
"lwt": "tele/szlaban/LWT",
"lwtPayload": "offline",
"topics": {
"statusSet": "cmnd/szlaban/POWER3"
},
"doorRunInSeconds": "4",
"pauseInSeconds": "22"
}
What happen ? In home(kit) app it should show "opening" state as soon as you push the "Szlaban" icon and switch to "open" state just after 4 sec., 22sec. later it should automatically show the "closing" state till the "closed" 4sec later.
Accessory no response.
What do means "Accessory no response." ?
It's working on daily base in my setup where I've a second gate without any sensor.
I'd try removing the "lwt" param.
In the HOME app - see the previous screenshot. When I press, nothing happens. I do not have the lwt parameter. Show me your configuration.
Please try removing :
"lwt": "tele/szlaban/LWT",
"lwtPayload": "offline",
Without result.
{
"accessory": "mqttgaragedoor",
"name": "Szlaban",
"url": "mqtt://192.168.99.170",
"username": "",
"password": "",
"caption": "Szlaban",
"topics": {
"statusSet": "cmnd/szlaban/POWER3"
},
"doorRunInSeconds": "4",
"pauseInSeconds": "22"
}
OK, some more investigation needed. Let me to check and I'll back as soon as possible.
OK, thank you very much.
Typo found in the code. Please re-download it and try again.
Didn't had these set. Now works perfectly! Thank you a lot for this awesome plugin. It is now in everyday use and since it has been very reliable.
My final working configuration:
{ "accessory": "mqttgaragedoor", "name": "Garage", "url": "mqtt://x.x.x.x", "username": "usr", "password": "pswd", "caption": "Garage", "lwt": "tele/sonoff_test/LWT", "lwtPayload": "Offline", "topics": { "statusSet": "cmnd/sonoff_test/POWER3", "openGet": "stat/sonoff_test/POWER2", "openValue": "ON", "closedGet": "stat/sonoff_test/POWER1", "closedValue": "ON", "openStatusCmdTopic": "cmnd/sonoff_test/POWER2", "closeStatusCmdTopic": "cmnd/sonoff_test/POWER1" }, "doorRunInSeconds": "20" },
Hi can i use this config with sonoff basic flashed with tasmota ?
It should work with sonoff basic but some hw hack will be need to get the additional IO pin as available on at the board.
It should work with sonoff basic but some hw hack will be need to get the additional IO pin as available on at the board.
Ok thanks, can I use it without open and close sensors ? Fake the response with tasmota rules ?
After using this awesome plugin for several days I have figured out that it will not show a offline device as "Not responding" in home app. If the device is offline I can still toggle it to open or close.
It should be possible to implement. Here one solution for another plugin, that worked great. Might be helpful: https://github.com/MacWyznawca/homebridge-mqtt-switch-tasmota/issues/29