Domoticz on RPi and ESP8266 - Newbie

Everything about esp8266 and more.

Moderator: leecollings

Post Reply
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Domoticz on RPi and ESP8266 - Newbie

Post 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:
Image

Image


This is the configuration on Domoticz where the idx is 1, as in the ESP Easy config:
Image

Image


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
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
maluko
Posts: 105
Joined: Sunday 02 February 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Portugal
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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 :)
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post by woody4165 »

maluko wrote: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 :)
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
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post by deennoo »

Then you can use évents with blocky or Lua or scène.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
toreandre
Posts: 91
Joined: Tuesday 19 January 2016 12:51
Target OS: -
Domoticz version:
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post by toreandre »

So when do I need to fill in the ESP Easy Devices tab?
When you are using sensors or switches.
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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:

Image

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
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
toreandre
Posts: 91
Joined: Tuesday 19 January 2016 12:51
Target OS: -
Domoticz version:
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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...
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

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

Image

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?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Domoticz on RPi and ESP8266 - Newbie

Post 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.
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest