Hi
I need some advice.
I am building a garage door opener based on ESP8266 module with wifi.
The device is not finished yet, but i have started building it.
It has a magnet sensor for checking if the garage door is open or not. It sends mqtt messages indicating open or closed.
These messages are received fine in ONH so it display a gui bulb glowing when it is open.
What I do need is a way to trigger the relay for controlling the door from onh.
It can be a http request, mqtt message or a plain socket, but it needs to be initiated from a onh item.
Any suggestions what to use?
Any help is appreciated
- PJ
Advice needed - Need to control external device
Re: Advice needed - Need to control external device
Hello,
You can create a Custom lamp for that. I use it with various DIY stuff. Just define the OnCommand and OffCommand way you like.
As an example I use this with my garage aircon esp8266 based MQTT switch:
OnCommand: exec,mosquitto_pub -t MyHome/Garage/Aircon/AirdryerIn -m 1
OffCommand: exec,mosquitto_pub -t MyHome/Garage/Aircon/AirdryerIn -m 0
Note. The Custom lamp has its limitations; I have not found a way to utilize state messages from the esp8266 device (thru MQTT). ONH defines State attribute of an object as read only, so it can’t be updated (e.g. via REST API) based on the real state of the device. Not ideal. Stefan, please consider this. Thanks!
Note2. Stefan, could you also consider adding an "Available" attribute to Custom lamp object? The nice thing about e.g. MQTT based switches is the ability to get info whether the switch/device is online or not. If not, it would be nice to be able to show this info in the GUI and use it in misc automations etc.
Summary:
1. Please allow changes to objects State attribute
2. Please add a new attribute, Available (true/false) and allow changes to that too
/Mikko
You can create a Custom lamp for that. I use it with various DIY stuff. Just define the OnCommand and OffCommand way you like.
As an example I use this with my garage aircon esp8266 based MQTT switch:
OnCommand: exec,mosquitto_pub -t MyHome/Garage/Aircon/AirdryerIn -m 1
OffCommand: exec,mosquitto_pub -t MyHome/Garage/Aircon/AirdryerIn -m 0
Note. The Custom lamp has its limitations; I have not found a way to utilize state messages from the esp8266 device (thru MQTT). ONH defines State attribute of an object as read only, so it can’t be updated (e.g. via REST API) based on the real state of the device. Not ideal. Stefan, please consider this. Thanks!
Note2. Stefan, could you also consider adding an "Available" attribute to Custom lamp object? The nice thing about e.g. MQTT based switches is the ability to get info whether the switch/device is online or not. If not, it would be nice to be able to show this info in the GUI and use it in misc automations etc.
Summary:
1. Please allow changes to objects State attribute
2. Please add a new attribute, Available (true/false) and allow changes to that too
/Mikko
Last edited by mikkot on Wed Feb 21, 2018 11:09 am, edited 3 times in total.
Re: Advice needed - Need to control external device
Thank you
I was looking at the Custom Lamp, but i didn't find a way to specify the command. Now I see that it is possible to set it after saving
This is valuable information![Smile :)](./images/smilies/icon_e_smile.gif)
-PJ
I was looking at the Custom Lamp, but i didn't find a way to specify the command. Now I see that it is possible to set it after saving
This is valuable information
![Smile :)](./images/smilies/icon_e_smile.gif)
-PJ