Page 1 of 1
Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 14:07
by woody4165
Hi all
just installed Domoticz to an "old" RPi B+ and it seems to work good.
I have loaded ESP Easy fw on and ESP12-E module connected to a relay, configure it and created a simple Virtual Switch in Domoticz.
This is the config of ESP Easy connected to the ip address of the Rpi where Domoticz is istalled:
This is the configuration on Domoticz where the idx is 1, as in the ESP Easy config:
I've tried sending the command via http using this
http://192.168.1.xx/control?cmd=GPIO,12,0 to the ESP and it's working.
Don't understand where is my error.
Can you please help?
Thanks
Vittorio
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 18:33
by maluko
You are do a little confusing, only have to configurate the espeasy switch if you want put a fisic button/switch to control a switch on domoticz.
like you want you dont have to put anything on task at esp, only put the "
http://192.168.1.xx/control?cmd=GPIO,12,0" on domoticz at "off action" and "
http://192.168.1.xx/control?cmd=GPIO,12,1" at "on action".
Try it

Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 19:54
by woody4165
Thanks!
It's working...
So when do I need to fill in the ESP Easy Devices tab?
Is it possible to set more than one command for a switch?
In my case I want to be sure that when I set ON a switch I have to set ON a GPIO and OFF another one.
Thanks again
Vittorio
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 20:06
by deennoo
Then you can use évents with blocky or Lua or scène.
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 20:09
by woody4165
deennoo wrote:Then you can use évents with blocky or Lua or scène.
Thanks.
Where I can find some more info on Blocky or Scenes related to Domoticz?
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 20:13
by toreandre
So when do I need to fill in the ESP Easy Devices tab?
When you are using sensors or switches.
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 20:16
by woody4165
toreandre wrote:
So when do I need to fill in the ESP Easy Devices tab?
When you are using sensors or switches.
By switches you mean non-virtual switches?
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 20:42
by woody4165
woody4165 wrote:deennoo wrote:Then you can use évents with blocky or Lua or scène.
Thanks.
Where I can find some more info on Blocky or Scenes related to Domoticz?
I have created an event like this:
do I need to connect with the switch or is it connected automatically?
I've tried to remove the http://.... from the On and Off action in the switch1 device, but it does'n work.
Thanks
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 21:52
by toreandre
woody4165 wrote:toreandre wrote:
So when do I need to fill in the ESP Easy Devices tab?
When you are using sensors or switches.
By switches you mean non-virtual switches?
Real switches and buttons that is fysical connected to the gpio pins on the ESP.
I have several capacitive touch buttons connected to one of my esp's to activate scenes in domoticz.
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Monday 14 March 2016 22:11
by deennoo
woody4165 wrote:deennoo wrote:Then you can use évents with blocky or Lua or scène.
Thanks.
Where I can find some more info on Blocky or Scenes related to Domoticz?
just follow the wiki !
https://www.domoticz.com/wiki/Events
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Tuesday 15 March 2016 8:56
by woody4165
toreandre wrote:woody4165 wrote:toreandre wrote:
When you are using sensors or switches.
By switches you mean non-virtual switches?
Real switches and buttons that is fysical connected to the gpio pins on the ESP.
I have several capacitive touch buttons connected to one of my esp's to activate scenes in domoticz.
I tought was valid also for virtual switch.
I followed this guide
http://www.esp8266.nu/index.php/Tutoria ... icz_Switch, but probably it doesn't work...
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Tuesday 15 March 2016 9:06
by woody4165
deennoo wrote:woody4165 wrote:deennoo wrote:Then you can use évents with blocky or Lua or scène.
Thanks.
Where I can find some more info on Blocky or Scenes related to Domoticz?
just follow the wiki !
https://www.domoticz.com/wiki/Events
Thanks
I created an event based on my virtual switch and put also a notification for Debug.
Simple If On else If Off.
It goes thru the notification (only if notification is before the url) and the real command I set is Open Url with http:// and the same url that was in the On Command and Off Command.
But when switch change the state, it doesn't turn On and Off the relay.
I tried first setting on the On state GPIO 12 to 0 and GPIO 13 to 1 (opposite for the Off Command).
Then I tried just to set one GPIO.
In the Blocky event before I just remve the notification since it's working.
In both cases it doesn't work, even if the notifications tells me that the event is running properly.
Any suggestion?
Re: Domoticz on RPi and ESP8266 - Newbie
Posted: Wednesday 16 March 2016 8:17
by woody4165
Just tried a LUA script version of what I was looking for, but partially.
This is the LUA script:
Code: Select all
commandArray = {}
print ("All based event fired");
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
if (deviceName=='switch1') then
if deviceValue == "On" then
print("Device is On")
commandArray['OpenURL'] = "http://192.168.1.xx/control?cmd=GPIO,12,0"
elseif deviceValue == "Off" then
print("Device is Off")
commandArray['OpenURL'] = "http://192.168.1.xx/control?cmd=GPIO,12,1"
end
end
end
What I would like to do, if possible, is to manage two relays with the same command, in my case relay1 ON and relay 2 OFF when switch1 is On and the opposite when it's Off.
I cannot pass two CommandArray with OpenURL because the second will overwrite the first (if it works).
How can I do it?
In any case, the same thing done with Blockly, as in the previous post, doesn't work. Strange!!!
I get an error
Error: Error opening url: "http://192.168.1.xx/control?cmd=GPIO
it's missing the comma after GPIO and everything after the comma.
Is there a different way to pass the "," into an http string?
Can someone help?
Thanks
EDIT:
Done it.
The issue was the comma in the url.
Just replaced the commas with %2c and now with Blockly works also with two consecutives OpenURL commands.