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

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post 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 ?
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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.
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post 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.
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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?
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post 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
Attachments
Capture.JPG
Capture.JPG (65.04 KiB) Viewed 8028 times
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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 8018 times
Then I do this:
switch.png
switch.png (53.07 KiB) Viewed 8018 times
I don't see anything like in your screen. ?!
SweetPants

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

Post by SweetPants »

You have to create a Dummy 'Virtual Sensor' Sensor Type 'Switch' and edit the switch On/Off action like Freijn said
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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)"
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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 7993 times
SweetPants

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

Post by SweetPants »

Maybe it should be replaced with "Virtual Devices" instead of "Virtual Sensors"
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

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

Post by freijn »

but........is it working now ?????? :-)
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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.
SweetPants

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

Post 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.
SumGuy
Posts: 10
Joined: Wednesday 24 April 2019 15:06
Target OS: Windows
Domoticz version:
Location: Canada
Contact:

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

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest