HTTP read GPIO input?
Moderators: grovkillen, Stuntteam, TD-er
HTTP read GPIO input?
Heya,
I've spent quite a bit of time browsing this forum and everything online -- trying to solve the opposite of:
http://<ESP IP address>/control?cmd=GPIO,<pin>,0
It is pretty easy to SET via simple HTTP, but is there anything in place to GET/Read data from a pin?
My end goal (as one other person on this site posted back in November) is to read data from a ds18b20 or see the status of a GPIO (1/0)
This is all for an ESP 201 currently running the EasyESP firmware.
Thanks!
I've spent quite a bit of time browsing this forum and everything online -- trying to solve the opposite of:
http://<ESP IP address>/control?cmd=GPIO,<pin>,0
It is pretty easy to SET via simple HTTP, but is there anything in place to GET/Read data from a pin?
My end goal (as one other person on this site posted back in November) is to read data from a ds18b20 or see the status of a GPIO (1/0)
This is all for an ESP 201 currently running the EasyESP firmware.
Thanks!
Re: HTTP read GPIO input?
I'm experimenting with a simple json interface to retrieve data from the ESP sensors (actually from tasks).
Could become available with the next build and may look like this:
Could become available with the next build and may look like this:
Code: Select all
{"Sensors":[
{
"TaskName": "PME",
"test": 3.30
},
{
"TaskName": "BMP Demo",
"Temperature": 20.06,
"Pressure": 981.87
},
{
"TaskName": "Lux sensor demo",
"Lux": 2.50
}
]}
Re: HTTP read GPIO input?
That would be amazing and thanks for the reply! Most little IoT things I've been working with thus far offers me at least some type of 'curl' simple output ability so I was absolutely in love with these 201 chips when I saw the HTTP commands but yeah the last piece to the puzzle is data the other direction via some JSON type utility.
I showed up late to the party regarding these chips but assume the EasyESP firmware is the best way to go as far as the most functionality without use of arduino/pi/etc?
I showed up late to the party regarding these chips but assume the EasyESP firmware is the best way to go as far as the most functionality without use of arduino/pi/etc?
Re: HTTP read GPIO input?
I know I am late to the party, but I'm about to convert some sonoff's to run ESP Easy and this feature would be excellent to use. Did it ever get added and if so which version do I need?
Re: HTTP read GPIO input?
Hello DA_Makers,
I have a sonoff and i have connected it trough the wifi whit domoticz
I can send form domoticz a "http://<ESP IP address>/control?cmd=GPIO,12,1" to switch the light on and a "http://<ESP IP address>/control?cmd=GPIO,12,0" to switch it off again.
so i think the function works.
I use version R78 on my sonoff's
I have a sonoff and i have connected it trough the wifi whit domoticz
I can send form domoticz a "http://<ESP IP address>/control?cmd=GPIO,12,1" to switch the light on and a "http://<ESP IP address>/control?cmd=GPIO,12,0" to switch it off again.
so i think the function works.
I use version R78 on my sonoff's
Re: HTTP read GPIO input?
Thanks - but are you able to read the status like the other post was suggesting with a GET request?Tjeerd wrote:Hello DA_Makers,
I have a sonoff and i have connected it trough the wifi whit domoticz
I can send form domoticz a "http://<ESP IP address>/control?cmd=GPIO,12,1" to switch the light on and a "http://<ESP IP address>/control?cmd=GPIO,12,0" to switch it off again.
so i think the function works.
I use version R78 on my sonoff's
Re: HTTP read GPIO input?
Well,
I see that in domoticz the lightbulb changes when im sending an on or off message (when sending the command not using domoticz).
So i think the sonoff is sending his state to Domoticz.
Futher i have attached a DHT22 tem/hum sensor to GPIO14 of the sonof and domoticz reads (get the data puched) the tempeture.
I dont know if this answers your question?
I see that in domoticz the lightbulb changes when im sending an on or off message (when sending the command not using domoticz).
So i think the sonoff is sending his state to Domoticz.
Futher i have attached a DHT22 tem/hum sensor to GPIO14 of the sonof and domoticz reads (get the data puched) the tempeture.
I dont know if this answers your question?
Re: HTTP read GPIO input?
Tjeerd wrote:Well,
I see that in domoticz the lightbulb changes when im sending an on or off message (when sending the command not using domoticz).
So i think the sonoff is sending his state to Domoticz.
Futher i have attached a DHT22 tem/hum sensor to GPIO14 of the sonof and domoticz reads (get the data puched) the tempeture.
I dont know if this answers your question?
Hi. The question was around having a json interface to retrieve state so I don't think this interface is related.
Re: HTTP read GPIO input?
I don't think there is a GET_command to read the state of an output but you can use events and rules (only available on R86 and higher) to synchronize the relais_state and the LED_state on the Sonoff with Domoticz.DA-Makes wrote:I know I am late to the party, but I'm about to convert some sonoff's to run ESP Easy and this feature would be excellent to use. Did it ever get added and if so which version do I need?
Search the forum for [rules + relais] and you will find the way how to synchronize the sonoff with Domoticz.
It will be something like this:
Code: Select all
on switchon do
gpio 12,1
gpio 13,0
inputswitchstate 0,1
endon
on switchoff do
gpio 12,0
gpio 13,1
inputswitchstate 0,0
endon
on Switch1#Switch do
if [Switch1#Switch]=1
event switchon
else
event switchoff
endif
endon
In Domoticz the commands to control the sonoff relais are :
http://192.168.178.104/control?cmd=event,switchon
http://192.168.178.104/control?cmd=event,switchoff
Re: HTTP read GPIO input?
costo wrote:I don't think there is a GET_command to read the state of an output but you can use events and rules (only available on R86 and higher) to synchronize the relais_state and the LED_state on the Sonoff with Domoticz.DA-Makes wrote:I know I am late to the party, but I'm about to convert some sonoff's to run ESP Easy and this feature would be excellent to use. Did it ever get added and if so which version do I need?
Search the forum for [rules + relais] and you will find the way how to synchronize the sonoff with Domoticz.
It will be something like this:In ESPEasy the relais is called Switch1 on GPIO-0Code: Select all
on switchon do gpio 12,1 gpio 13,0 inputswitchstate 0,1 endon on switchoff do gpio 12,0 gpio 13,1 inputswitchstate 0,0 endon on Switch1#Switch do if [Switch1#Switch]=1 event switchon else event switchoff endif endon
In Domoticz the commands to control the sonoff relais are :
http://192.168.178.104/control?cmd=event,switchon
http://192.168.178.104/control?cmd=event,switchoff
I don't have Domoticz (or want it) and was hoping that the suggestion from GMaster1 above had been added as direct JSON get requests would have been very useful.
Re: HTTP read GPIO input?
It does not need to be Domoticz to control your sonoff relais.
As long as your controlling server can fire the command: "IPofYourESPEasy/control?cmd=event,switchon" or switchoff it will work
As long as your controlling server can fire the command: "IPofYourESPEasy/control?cmd=event,switchon" or switchoff it will work
Re: HTTP read GPIO input?
costo wrote:It does not need to be Domoticz to control your sonoff relais.
As long as your controlling server can fire the command: "IPofYourESPEasy/control?cmd=event,switchon" or switchoff it will work
I was looking for a way to query the sonoff for its current state as per the post from GMaster1 asking if he can make a JSON get request against the sonoff.
Re: HTTP read GPIO input?
To my knowledge, there is no command to read the state of an output in ESPEasy.DA-Makes wrote: I was looking for a way to query the sonoff for its current state as per the post from GMaster1 asking if he can make a JSON get request against the sonoff.
Re: HTTP read GPIO input?
Sure there is!!costo wrote:To my knowledge, there is no command to read the state of an output in ESPEasy.DA-Makes wrote: I was looking for a way to query the sonoff for its current state as per the post from GMaster1 asking if he can make a JSON get request against the sonoff.
See: http://www.esp8266.nu/forum/viewtopic.php?f=4&t=1431
Regards
Dave
Re: HTTP read GPIO input?
Thanks but this isn't quite the same thing, I wanted to be able to check state from non ESP devices. The JSON get that was discussed at the beginning of this thread would have been perfect.dduley wrote:Sure there is!!costo wrote:To my knowledge, there is no command to read the state of an output in ESPEasy.DA-Makes wrote: I was looking for a way to query the sonoff for its current state as per the post from GMaster1 asking if he can make a JSON get request against the sonoff.
See: http://www.esp8266.nu/forum/viewtopic.php?f=4&t=1431
Regards
Dave
Who is online
Users browsing this forum: No registered users and 18 guests