Page 1 of 1

How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Wednesday 24 April 2019 15:23
by SumGuy
I'm new to Domiticz. I'm wondering if Domoticz is the best way (on a windows PC or old android tablet) to control an ESP8266 module. I just want to be able to set or read the state of a few GPIO lines. The 8266 can have either the factory AT firmware, or ESPEasy, or NODE-MCU (which-ever is most compatible with Domoticz). Let me know if there are any instructions or guides on this. Thanks.

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Wednesday 24 April 2019 20:29
by freijn
With the ESPeasy you can sent command or ready status with direct url's from the ESP8266.

If you have Domoticz the ESP8266 can report status directly into the Domoticx with a few clicks.

Commands you do with http://192.168.1.162/control?cmd=GPIO,14,0 from the action form in the switch.

Hope this does help you ?

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Friday 26 April 2019 4:16
by SumGuy
I'm trying to follow this instruction: https://www.letscontrolit.com/wiki/index.php/Relais

But that is for Domoticz V2.2758. I have installed V4.10618 and I can't find that window showing the setup for a switch like it appears in the V2.2758 example. Starting with fresh new install of Domoticz I have no idea what steps to perform to get the ESP8266 with ESPEasy to work.

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Friday 26 April 2019 8:34
by freijn
Start with the basics first does the http://<ESP IP address>/control?cmd=GPIO,<pin>,0 and Start with the basics first does the http://<ESP IP address>/control?cmd=GPIO,<pin>,1 work for you? work for you?


Then you create a switch, take an on/off switch in the http field you use

http://<ESP IP address>/control?cmd=GPIO,<pin>,0
http://<ESP IP address>/control?cmd=GPIO,<pin>,1

It is not related to a version of domoticz.

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Friday 26 April 2019 14:45
by SumGuy
Yes, the http commands work and the relay switches on and off.

To add the ESP8266 to the Domoticz setup, I can either select Setup, Devices or I can select Switches (from the main options). I assume I select Switches. At Switches, I can select Learn Light/Switch, or Manual Light/Switch. I assume I select Manual. I now have small window with drop-downs that contain no options. Hardware dropdown is empty when selected. I can't do anything in that window.

I restart Domoticz. I see No favorite devices defined. Please setup your hardware. Ok, I select Hardware. I see a data entry form. Name - I call it ESP8266. Type. No idea what to select. I don't see "Generic ESP8266 device" in the list. I see HTTP/HTTPS poller, and I see "Dummy" - virtual switch. Those are the only 2 possibilities that stand out for me. I create the virtual switch. I go back to Switches, Manual, in hardware I see ESP8266. I can type something for Device Name. Switch type - I select On/Off. Under Type, there is a long list. Nothing is obvious to me. I select GPIO. Next (under Type) is a GPIO drop-down list. It has "N/A" and nothing else. Then there is a Test button, and under that is "As (main device) or (sub/slave device). I see no where to enter URL's for the commands to the 8266 to turn on /off the relay. That is why I was asking how to get them?

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Friday 26 April 2019 21:39
by freijn
Hi Sum

You are making your life too difficult :-)

Just create a dummy switch, name it after the function of the first relais "Floorlamp?" type is an on/off switch

The goto the switch in the switch page and put in the url's

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 5:50
by SumGuy
I don't know how you get to that screen showing that form. First I do this:
device.png
device.png (54.93 KiB) Viewed 8030 times
Then I do this:
switch.png
switch.png (53.07 KiB) Viewed 8030 times
I don't see anything like in your screen. ?!

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 9:36
by SweetPants
You have to create a Dummy 'Virtual Sensor' Sensor Type 'Switch' and edit the switch On/Off action like Freijn said

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 15:05
by SumGuy
> You have to create a Dummy 'Virtual Sensor' Sensor Type 'Switch' and edit the switch On/Off action

Where do I CREATE "Dummy Virtual Sensor" ?!

On this page: http://127.0.0.1:8080/#/Hardware ?

If it is on that page, then what Type? I do not see "Sensor" or "Virtual Sensor" in the Type drop-down list !!!

The only place I see Virtual or Dummy is "Dummy (Does nothing, used for virtual switches only)"

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 15:29
by SumGuy
Ah...

I did not notice that "Create Virtual Sensors" was a clickable item on the Hardware screen. And I wouldn't have thought that I would have to click it anyways, because it refers to "sensors" and not a switch. I would suggest a different way to handle this - it was not intuitive.
device1.png
device1.png (72.3 KiB) Viewed 8005 times

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 16:13
by SweetPants
Maybe it should be replaced with "Virtual Devices" instead of "Virtual Sensors"

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Saturday 27 April 2019 16:44
by freijn
but........is it working now ?????? :-)

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Sunday 28 April 2019 4:36
by SumGuy
Yes it is working. When I click the light-bulb icon on the Devices screen I can turn the relay on and off. I am now trying to figure out what to do next with Domoticz to make this function more usable.

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Sunday 28 April 2019 11:22
by SweetPants
SumGuy wrote: Sunday 28 April 2019 4:36 I am now trying to figure out what to do next with Domoticz to make this function more usable.
Search the forum and dive into dzVentz (scripts), there are numerous projects which make domoticz a very nice Home Automation project. Add some sensors (Temp/Hum) and intelligently control your bathroom fan, add door/window sensors and create your own alarm system, add motion sensors (PIR), add presence detection to see who is at home and enable/disable your alarm system, add weather information and so on and so on. I am using Domoticz since 2013 and still busy adding functionality to it.

Re: How to read/set GPIO on ESP8266 with ESP Easy firmware?

Posted: Monday 29 April 2019 3:43
by SumGuy
One project I have in mind is to control an animal trap (like this one: https://cdn.domyown.com/images/thumbnai ... 4x1023.jpg) by rigging it with a solenoid so I can activate the trap manually, as well as have it change a GPIO input to indicate the animal has tripped the latch and is caught. Right now I have my traps under video observation but would like more manual control and more timely indication that animal has been caught. I bet that integrating a cage trap as part of a home automation system hasn't been done yet eh?