Closed zylxpl closed 1 year ago
Firstly, conditions: "{{ data.topic_basename == '0' }}" is redundant and does not need to be there.
Second, the payload are integers, try removing the qoutes from the value
This is only part of the code, as this device have two switches, second one is using conditions: "{{ data.topic_basename == '0' }}"
. Anyway, i try to set up it with only 1 switch, setting exact topic name and removing conditions, no difference. Also tried without quotes, same result.
What is strange, when i set topic like shellies/shellyswitch25-xxxxxxxxxxxx/#
in mqtt tool, i can see messages coming to /input/0
and /input/1
topics, but if i set up the same in Switch Manager cant find anything in debug console (but every other topic pops there).
When the device is discovered it will have a static topic, so a blueprint will always be either /input/0 or /input/1 (not both although the readme does have an option to include sub topics which you'll need to define). Generally, the mqtt_topic_format is just a helper for autodiscovery. Did you define the topic manually (from creating a switch) to see if that works? for example set the topic to shellies/shellyswitch25-xxxxxxxxxxxx/input/0.
If that fails, just send me a dump off the MQTT for shellies/shellyswitch25-xxxxxxxxxxxx and its sub topics and I'll try to figure it out.
Yes, i did exactly that, and it was not working. How can i create mqtt dump?? Also, i was experimenting with sub topic setting, but could not understand how it exactly suppose to work. Where do i need to define subtopics?
Easiest way is just get mqtt explorer and just screen shot the topics. I will put the subtopic stuff in and send you an example blueprint once I get it working.
Also if your shelly device had already been added to HA then there are blueprints that uses the event bus instead of MQTT
Is this enough? Can't use event bus, as my shelly device's are only connected to ha via mqtt (they are in separate locations)
Could you please update Switch Manager to v1.2.1 as I found a bug that would've been causing you the issues.
The following example should get you going.
name: Shelly 2.5 MQTT
service: Shelly
event_type: mqtt
mqtt_topic_format: shellies/+/input
mqtt_sub_topics: true
buttons:
- conditions:
- key: topic_basename
value: "1"
actions:
- title: init
conditions:
- key: payload
value: 1
- title: hold (released)
conditions:
- key: payload
value: 0
Take note of mqtt_sub_topics: true
. This means that your set topic should be shellies/shellyswitch25-xxxxxxxxxxxx/input and the sub topics from there will automatically be handled by the blueprint.
Also I have tested this with variations of both endpoints (0 and 1) and payloads (0 and 1) which was working correctly.
Edit: It could also work with the MQTT topic set to shellies/shellyswitch25-xxxxxxxxxxxx/input/+ (while also removing mqtt_sub_topics: true
) but honestly, I haven't experimented enough with using sub topics as generally most MQTT devices has used a single topic for all actions
Trying to create blueprint for mqtt switch that publish physical state under topic:
shellies/+/input/0
andshellies/+/input/1
as payload 0 or 1. Verified multiple times that the topic name is correct: . However , for some reason Switch Manager is not recognizing this topic no matter what i try. What is even more strange, when i set up mqtt topic for a switch with #, feshellies/shellyswitch25-xxxxxxxxxxxx/#
i can see messages in debug consoles from all other topics associated with this switch (/relay, /input_event, /temperature etc) but not forinput/0
orinput/1
.MQTT documentation for this switch: https://shelly-api-docs.shelly.cloud/gen1/#shelly2-5-mqtt