D1 Mini & OpenHab

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Michael_BruceLee
Normal user
Posts: 10
Joined: 16 Feb 2018, 12:06

D1 Mini & OpenHab

#1 Post by Michael_BruceLee » 07 Oct 2020, 13:55

Hi Guys
i got a problem with my d1mini and espeasymega20190108.
go an capacitive touch sensor(with a built in led) on gpio12 and i can switch it on and off as it supposed to be.
device is a normal switch.
i can turn it on and off via openhab (mqtt) to and i get the state in openhab.
my problem is: if i turn the switch (touch) manually on it shows in openhab but if i want to turn the switch off via openhab (mqtt) i get the message in the log (SW: GPIO 12 Set to 0) but the switch is still on.
so basically i can turn it on and off only both manually or both with openhab.
is there any solution for that?
thanks a lot!!!

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: D1 Mini & OpenHab

#2 Post by ThomasB » 07 Oct 2020, 20:08

I suggest updating to the latest Mega release. No promises, but it might solve your problem.

- Thomas

Michael_BruceLee
Normal user
Posts: 10
Joined: 16 Feb 2018, 12:06

Re: D1 Mini & OpenHab

#3 Post by Michael_BruceLee » 08 Oct 2020, 16:27

thanks for the idea but it didn´t work :-(

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: D1 Mini & OpenHab

#4 Post by mrwee » 08 Oct 2020, 16:38

Please share your openhab config (item, thing, sitemap) concerning the device

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: D1 Mini & OpenHab

#5 Post by Ath » 08 Oct 2020, 17:22

Interesting to know: Has it ever worked as you describe it?
/Ton (PayPal.me)

Michael_BruceLee
Normal user
Posts: 10
Joined: 16 Feb 2018, 12:06

Re: D1 Mini & OpenHab

#6 Post by Michael_BruceLee » 09 Oct 2020, 10:42

my openhab config:
item:
Switch TouchPS4_Blau "PS4-Touch-Blau [MAP(touch.map):%s]" {mqtt=">[Sentshuas:TouchModule/gpio/14:command:ON:1.00],>[Sentshuas:TouchModule/gpio/14:command:OFF:0.00],<[Sentshuas:TouchModule/blau/blau_touch:state:MAP(touch.map)]"}

i got three of these with for sure different names and gpio ;-)

sitemap:
Switch item=TouchPS4_Blau label="Blau" mappings=[ON="ON",OFF="OFF"]

it don´t think the problem is in openhab because i see the right switch state and can control them out of openhab.
i´ve tried tasmota yesterday and there is kinda the same problem. if i switch it on and off manually everything is ok same if i do that on the software side... but if i crossfire there is no registration.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: D1 Mini & OpenHab

#7 Post by Ath » 09 Oct 2020, 10:47

Michael_BruceLee wrote: 09 Oct 2020, 10:42 i´ve tried tasmota yesterday and there is kinda the same problem.
That's why I asked if it ever worked as intended, or is this a new 'expected behavior'?
/Ton (PayPal.me)

Michael_BruceLee
Normal user
Posts: 10
Joined: 16 Feb 2018, 12:06

Re: D1 Mini & OpenHab

#8 Post by Michael_BruceLee » 09 Oct 2020, 10:52

hey ;-)
no it didn´t work yet

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: D1 Mini & OpenHab

#9 Post by mrwee » 09 Oct 2020, 14:58

It looks like an older openHAB, I had many issues before upgrading to latest. Much more complex MQTT than before, but it works better.

Can't see the reason why your setup doesn't work. logs + MQTT.fx or MQTT Explorer is the best way forward :?

Michael_BruceLee
Normal user
Posts: 10
Joined: 16 Feb 2018, 12:06

Re: D1 Mini & OpenHab

#10 Post by Michael_BruceLee » 09 Oct 2020, 17:55

ya i don´t wanna upgrade now because of openhab 3 comming soon but i got 2.4 soo its not soo old ;-)
ya i got mqtt.fx and even on the esp log i see that openhab sends the "message" SW: GPIO 12 Set to 0 but nothing changes on the esp.
even when i pull the string on the webbrowser with the right command i can´t get the esp to do something only if i send the on command and off command in the web not when crossover thats so weird. maybe i need a rule in esp or something

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: D1 Mini & OpenHab

#11 Post by ThomasB » 09 Oct 2020, 18:11

I'm using OH 2.4 with ESPEasy. I don't have any issues. I think my success is because I never directly control GPIO. Instead, I use events and have the GPIO controlled in ESPEasy rules.
For example, here is a OH item for one of my GPIO controlled devices:

Code: Select all

Switch Attic_AC    "Attic Relay AC"   <poweroutlet-us> (Equipment) ["Switchable"] {mqtt=">[mosquitto:ESPEZ_Attic/cmd:command:ON:Event,RelayOn],>[mosquitto:ESPEZ_Attic/cmd:command:OFF:Event,RelayOff],<[mosquitto:ESPEZ_Attic/STATEVAR/rlyval:state:OFF:-1],<[mosquitto:ESPEZ_Attic/STATEVAR/rlyval:state:ON:1]"}
The RelayOn and RelayOff events are rules in ESPEasy that switch the relay.

Code: Select all

On RelayOn do
     gpio,12,1
     Publish %sysname%/STATEVAR/rlyval,1
endon

On RelayOff do
     gpio,12,0
     Publish %sysname%/STATEVAR/rlyval,-1
endon
You'll also need a ESPEasy rule that calls RelayOn / RelayOff events when the touch sensor is used.

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests