andriuskr
(Andrius)
February 3, 2021, 8:17am
1
Hello,
Using Mosquito MQTT and Shelly 2.5 via MQTT. Trying to implement button long push action. My automation simple automation for testing :
alias: 1 2aukstas long press
description: ''
trigger:
- platform: mqtt
topic: shellies/shellyswitch25-40F5202A29E1/input_event/0
- platform: mqtt
topic: shellies/shellyswitch25-40F5202A29E1/input_event/1
condition:
- condition: template
value_template: '{{ trigger.payload_json.event == ''L'' }}'
action:
- service: notify.mobile_app_andriaus_iphone_pro
data:
message: mygtukas long push
- service: light.turn_off
data: {}
entity_id: light.2nd_floor_foyer_light
mode: single
The problem is: First long push is working,but after this automation goes to infinite look trigering action every 30 seconds
tom_l
February 3, 2021, 8:28am
2
Please edit your post and format your pasted automation confg correctly. See point 11 here: Help us help you
deisi
February 3, 2021, 11:33pm
3
This will trigger when input_event
is 1 or 0 is that the desired behavior? Each entry in trigger can fire the automation. If yes, I guess not pushing the button sets the trigger.payload_json.event
to ‘L’ what makes kind of sense, as you haven’t pushed the button for long.
andriuskr
(Andrius)
February 4, 2021, 5:03am
4
/input_event/ 0 or 1 defines the relay/button on the wall. if i manually long press - it works. The problem is that MQTT trigger somehow keeps triggeding every 30 seconds.
tom_l
February 4, 2021, 5:09am
5
Watch the topics with something like MQTT Explorer (free) to see what is being published to them.
Actually it will trigger when anything is published to either of the topics:
topic: shellies/shellyswitch25-40F5202A29E1/input_event/0
topic: shellies/shellyswitch25-40F5202A29E1/input_event/1
But should be prevented from executing the actions unless the payload condition '{{ trigger.payload_json.event == ''L'' }}'
evaluates as true.
andriuskr
(Andrius)
February 4, 2021, 5:12am
6
Ah, i just subscibed to topic via Mosquito plugin configuration and see that the same is published every 30 seconds. Why ?
tom_l
February 4, 2021, 6:20am
7
According to the Shelly API I think you should be monitoring this insted:
Input events can be monitored on:
shellies/shellyswitch25-<deviceid>/longpush/<i>
for each SW input <i>
; reports a value indicating longpush state as 0
(shortpush) or 1
(longpush)
See Welcome to Shelly Technical Documentation | Shelly Technical Documentation
deisi
February 4, 2021, 10:35am
8
you are perfectly right, my bad.
andriuskr
(Andrius)
February 4, 2021, 1:51pm
9
Yes, thanks. it works with shellies/shellyswitch25-40F5202A29E1/longpush/1
1 Like