Problem with Sensor Switch with Domoticz

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
Posts: 1
Joined: Thursday 12 July 2018 0:55
Target OS: Raspberry Pi
Domoticz version:

Problem with Sensor Switch with Domoticz

Post by rjames65 » Thursday 12 July 2018 1:30

My goal is to use an ESP-01 module with a DS18B20 and a float switch for monitoring the temperature and water level in my aquarium.

At the moment I'm just at the breadboard stage trying to get everything working. The DS18B20 is working fine and communicating to Domoticz without drama. My issue is with the switch sensor.

I have the switch connected to GPIO-1 with a 10k pull-up resistor, the switch goes to ground through a 1k resistor to protect the pin in case it is accidentally driven high while the switch is active (because blowing this pin would effectively brick the device). Serial is disabled so I can use GPIO-1 as an IO. If I use an IDX/Var value that doesn't exist in Domoticz, and monitor the ESP module by refreshing the web browser, the switch works perfectly - the value changes from 0 to 1 and back to 0 as I would expect. When I look in the Log, I get entries of State:1 and State:0 as I would expect. Therefore I am confident that my hardware is fine, and the problem I'm having is a software issue.

My problem occurs when I then try to link the switch to Domoticz. I have a "Dummy" hardware device in Domoticz, to which I have added the virtual sensors - one for temperature, and one for the switch. As soon as I set the IDX/Var in ESP-Easy to match the switch ID in Domoticz I get the following behaviour:

Initially, both Domoticz and ESP-Easy will report the switch value as Off/0.
When I activate the switch, both Domoticz and ESP-Easy report the switch as On/1. So far so good.
The problem arises when I release the switch - Both Domoticz and ESP-Easy continue to report the switch as On/1. From this point onward, everything I do with the switch is ignored. ESP-Easy constantly reports 1, and Domoticz constantly reports the switch as on. If I look in the Log on ESP-Easy it reports a new entry of "State 1" each time I activate the switch, but never reports an entry of "State 0".
If I press the switch in Domoticz, it turns off, and then the ESP will report the switch as 0. From then on, it will always report the switch as 0, regardless of whether the switch is activated or not. Now, in the log, it reports a "State 0" every time I reset the switch, but never reports "State 1".
It's as if, once the ESP is connected to Domoticz, it completely ignores what the hardware says, and only believes what Domoticz says. Domoticz becomes in control instead of the hardware being in control.

I've tried to search forums etc to see how to set up this kind of thing, but either my search terms are wrong, or no-one else is trying to do anything similar. Is there something simple I'm doing wrong?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests