Espeasy with Esp8266 & Domoticz Switch with current feedback

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
gigiovanni
Posts: 1
Joined: Saturday 24 September 2016 13:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by gigiovanni »

Hi everyone,
I started some days ago to play with an ESP8266 board i bought from this website (i attach you the link for references):
http://www.electrodragon.com/product/wi ... d-esp8266/

The board come with standard Fw for ESP-12F (maybe nodemcu with AT command) that i substituted with EspeasyR120 release. I also have a Raspberry Pi 2B where i run the Domoticz server. All it's ok with the first play, i'm able to set a new lamp in Domoticz and switch it on/off (IDX confinguration) using the Espeasy API command, I was also able to read an input switch and to link switch with lamp to make control of the lamp by switch.

Now i want to add more features to this my first sample and i have some trouble , i'll explain. In my house all lamp light are 220Vac and they are controlled through relay with mechanical memory. It sounds like when you press the button on the wall (pulsing button, not on/off switch) it excite the relay that switch on next position and turn on the light. The simplest relay has only two position (on and off) there are also relay with more position that make combination of the light (es four position).

I want to setup with espeasy + domoticz a lamp device on the dashboard where the status is given from adc read of esp8266 where i connect a current sensor to voltage converter (like acs712) and the light command can change dinamically, so if current flow is less than a minimal costant value the lamp is off so if i click the lamp it has to send th on command, while if the current is actually low it sound like the light is off so if you click the lamp icon on the dashboard it has to send the "on" command.

I attach a schema of the system i would to make, it is the simplest way to mantain the old electrical scheme working also if domotic or esp8266 are blocked or burnout.

I've read that both espeasy and domoticz can be customized with script, but at the moment i've not idea how to make it, so any help on what to study to make this will be appreciated.

Best regards and thank you all!
Attachments
reduced.jpg
reduced.jpg (120.88 KiB) Viewed 6202 times
domoticzag
Posts: 24
Joined: Tuesday 13 September 2016 19:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by domoticzag »

Did it work out with your project? looking for an similar solution. Can you put the ADC value in a domoticz device/variable?
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips
cobra82
Posts: 1
Joined: Monday 01 January 2018 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by cobra82 »

Hi,

I've a similar setup.

EspEasyR120 on Wemos D1 Mini + 5v TTL Optocoupler + 5v Relays.

I can send pulse to relay and read 220v status with a virtual switch
Is there a Domoticz dashboard widget that report switch status Reading a virtual switch?

Now I have 2 widget and I Need only One instead...

Best Regards

https://www.ebay.com/itm/5V-1-Channel-O ... 2665744386
Attachments
445302503_27448.jpg
445302503_27448.jpg (49.21 KiB) Viewed 4650 times
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by kimot »

And what about sending from domoticz to ESPeasy event ( LampChange ) when switch on dashboard is pressed.

In ESPeasy through rules write event LampChange and check status of lamp, change this status and report it back to Domoticz, so dashboard icon will correspond true state of lamp.
The same way, if status is changed through hw switch, report it to Domoticz.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
angelodipa
Posts: 1
Joined: Saturday 06 January 2018 8:24
Target OS: Windows
Domoticz version:
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by angelodipa »

it's great... i,m looking for too...

I've 8 reay but a don't Know how can i cotrol these in domoticz.

Can you explain in datailed mode how is possoble???
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by kimot »

For example my setup:

1) Domoticz with switch defined
2) ESP01 at x.x.x.101 with relay (GPIO12), LED (GPIO13) and push button
3) ESP02 at x.x.x.100 with Push button
.... And you can add other ESPEasys with buttons

I want change relay status with each press of button on ESP01 or ESP02 and report this to state of switchto Domoticz.
Change relay status from click on switch in Domoticz.

First - define dummy switch (its idx=19 in my case ) and actions for ON and OFF in Domoticz
Send event to ESP01
Dom_01.png
Dom_01.png (319.53 KiB) Viewed 4557 times
On ESP01define switch SW01 and write rules:

Code: Select all

on lamp_on do
    gpio,12,1   //relay
    gpio,13,0   //led
endon

on lamp_off do
    gpio,12,0
    gpio,13,1
endon

on lamp_change do
  if [rele#Switch]=1
    event,lamp_off
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=Off
  else
    event,lamp_on
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=On
  endif
endon

on SW01#Switch do
  event,lamp_change
endon
On ESP02 define switch and with each its press send event "lamp_change" to ESP01
On others eventually wifi switches do the same.

In this configuration, if Domoticz is down, and wifi works, you can use all switches.
If wifi is down, you can localy drive relay like normal wall switch.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by kimot »

@ gigiovanni
WIth acs712 you cannot directly measure AC.
Its circuit diagram is here:
http://www.electroschematics.com/11279/ ... ntrollers/

And for AC you need something like at end of this:
https://www.sunrom.com/p/current-sensor-20a-acs712
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
irongarment
Posts: 12
Joined: Friday 24 November 2017 21:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: New Zealand
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by irongarment »

How do you update the icon status without causing Domoticz to send a command?

For example, doing this in ESPeasy

SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=On

...will cause the "on" action to happen.

I want to be able to change the icon state without causing an action to happen. Any ideas?
Last edited by irongarment on Sunday 21 January 2018 19:38, edited 1 time in total.
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by kimot »

But my "lamp_on" and "lamp_off" actions only sets gpio pin - nothing is send to Domoticz in these actions.
So if Domoticz sends this command again, nothing happens, because pin is set previously.
I think, there is no other solution, if you want indicate state of relay and control relay by one icon in the same time.

If you only want indicate status, do not write any commands to "OnAction" and "Off Action" boxes in Domoticz
and maybe choose different switch type - "contact" for example to not allow user change status by clicking on it.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
irongarment
Posts: 12
Joined: Friday 24 November 2017 21:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: New Zealand
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by irongarment »

Thanks. I understand, but that's no good. I think there should be some way to decouple the indicator from the switch, so that the state of the object can be changed independently from clicking on the button.

I'll keep looking for a solution.
srushti
Posts: 7
Joined: Monday 10 August 2020 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by srushti »

kimot wrote: Saturday 06 January 2018 22:22 For example my setup:

1) Domoticz with switch defined
2) ESP01 at x.x.x.101 with relay (GPIO12), LED (GPIO13) and push button
3) ESP02 at x.x.x.100 with Push button
.... And you can add other ESPEasys with buttons

I want change relay status with each press of button on ESP01 or ESP02 and report this to state of switchto Domoticz.
Change relay status from click on switch in Domoticz.

First - define dummy switch (its idx=19 in my case ) and actions for ON and OFF in Domoticz
Send event to ESP01
Dom_01.png

On ESP01define switch SW01 and write rules:

Code: Select all

on lamp_on do
    gpio,12,1   //relay
    gpio,13,0   //led
endon

on lamp_off do
    gpio,12,0
    gpio,13,1
endon

on lamp_change do
  if [rele#Switch]=1
    event,lamp_off
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=Off
  else
    event,lamp_on
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=On
  endif
endon

on SW01#Switch do
  event,lamp_change
endon
On ESP02 define switch and with each its press send event "lamp_change" to ESP01
On others eventually wifi switches do the same.

In this configuration, if Domoticz is down, and wifi works, you can use all switches.
If wifi is down, you can localy drive relay like normal wall switch.
Hello,
I am facing the same issue and I want to update the status of the switch on domoticz when I toggle a wall switch. Can you please help me with the hardware setup of these connections and any additional details will be helpful.
Thanks,
Srushti.
kimot
Posts: 104
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: Espeasy with Esp8266 & Domoticz Switch with current feedback

Post by kimot »

Hardware setup?
For example Sonoff Basic.
Code for Domoticz and ESPeasy rules are in my post.
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests