#Blueprint not triggering Z2M
1 messages ยท Page 1 of 1 (latest)
I don't have any experience with that blueprint, but first things first. Are you sure it's not triggering?
(I moved to a thread to keep the complaints down...)
If you are sure it's not triggering, look in the logs to see if it is kicking up errors.
Thanks for your help. Yeah, in my automations list, the one in question says "Never" under last triggered
Nothing in logs that I can see.
I can make an automation (without the blueprint) that succesfully triggers when a button is pressed like this:
`platform: state
entity_id:
- sensor.switch_cinema8way_action
to: on_1`
But I would really like to make the blueprint work as otherwise I end up making tons and tons of individual automations for each button
So looking at it, it's triggering off of the MQTT directly. Do you have mqtt-explorer installed?
that's new to me, I don't think so
See the blueprintis pulling mqtt data, that state of the switch you quote there is the HA state, they may not exactly match
Ah okay. Hang on will set up the explorer
ah actually I can see this in my zigbee2mqtt log
it's a bit busy there, but yes, probably
2023-01-23 19:58:41 MQTT publish: topic 'zigbee2mqtt/Switch-Cinema 8Way', payload '{"action":"', "battery": 200, "linkquality": 102}' 2023-01-23 19:58:41 MOTT publish: topic 'zigbee2matt/Switch- Cinema gWay/action', payload 'on_1'
that's copied a bit weird one sec
MQTT publish: topic 'zigbee2mqtt/Switch-Cinema 8Way/action', payload 'on_1'
OK, so next problem you should fix that may be breaking things on you is those spaces and punctuation in the topic / friendly_name. I suggest this to my customers and it often fixes things...
https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.md#-to-make-the-blueprint-work-it-will-need
probably just the 2nt one your your case
Ah actually there aren't any space in there, it's just for some reason I can't copy text off the zigbee2mqtt log so I used a screenshot>OCR tool which didn't do a great job. the topic is definitely zigbee2mqtt/Switch-Cinema8Way/action in the logs, no spaces
but maybe it's the hyphen?
maybe
I stand correted. That is looking at the HA sensor, not the MQTT side.
That restart mode seems strange to me actually. may not be the problem but Z2M pops out a null trigger before and after actual actions, ai I always run these in single mode.
mode: single
Net thing to look at is the sensor in developer mode - state to see what HA is seeing.
OK, I tried changing the mode to single in the blueprint yaml, and reloaded automations. That seemed to make no difference.
If that does fix the problem, I suggest doing an issue on that GIT to have them change it....
Ah so in the developer mode, it seems like pressing a button never shows a change in the state of the sensor. Looking at the logbook, it DOES change the state momentarily when I press a button, but then it seems to set the state back to nothing when I release the button
That's how Z2M works.
If set for a few minutes, it's asleep
trigger a button- wake trigger happens
null trigger is sent to clear that
button action is sent
null trigger action is sent to clear that
Understood. And the !input here means it should trigger when there's any input at all?
`trigger:
- platform: state
entity_id: !input "remote"
attribute: action`
So this blueprint doesn't screen out all those unwanted triggers, and therefore if/when it does work, it will be spamming the log with junk.
yes
In this case you were / are not getting triggers at all,
should be getting more that you want. Points to it's not the right sensor or something.
Or a fundamental problem with the blueprint.
Hmm. So weird. The blueprint code seems so straightforward
And this trigger.to_state from the blueprint seems correct?
`action:
- variables:
command: "{{ trigger.to_state.state }}" - choose:
- conditions:
- "{{ command == 'on_1' }}"
sequence: !input "on_button_1_short"`
- "{{ command == 'on_1' }}"
- conditions:
I fix the triggers that aren't wanted spamming the logs this way.
https://community.home-assistant.io/t/z2m-aqara-opple-4-boutons-blueprint-wxcjkg12lm/279950/25?u=sir_goodenough
That trigger should work I think. I have a blueprint that does it a bit different, but the say-ish...
trigger:
- platform: state
entity_id: !input 'remote'
action:
- variables:
event: '{{ trigger.to_state.attributes.action }}'
entity_id: !input 'remote'
friendly_name: '{{ trigger.to_state.attributes.friendly_name }}'
I just trigger on any state change and pull out the action attribute. They trigger on a state change of the action attribute and use it that way.
One thing I notice, is that in the trigger bit of the blueprint, it is looking for an 'attribute' of 'action':
`trigger:
- platform: state
entity_id: !input "remote"
attribute: action`
but in the HA developer tools, it's not showing 'action' as an attribute, it's just that the sensor itself is called sensor.switchcinema8way_action
ok
so maybe I should try removing the attribute: action from the blueprint?
YES THAT FIXED IT
๐๐๐๐๐
You are in a different mode in Z2m... Thereare 2 modes, this style needs the legacy mode or you have to ajust things to get it to work in the other mode
is that the 'Legacy API' setting in Z2M?
it's off at the moment in my settings
Ah okay so you mean these settings https://share.cleanshot.com/Py5pc0JK
That should work. make sure and test stuff out.
I haven't touched those so that must be the default. I'll try turning on the legacy entity attributes and see if anything else breaks ๐
Thanks so much for walking me through this logically, I really appreciate it
I hate it when people put Blueprints out with no documentation or knowledge of what they are doing. That person appears to be more interested in selling the devices that making a good blueprint to use them.
there definitely seems to be a lot of variability in the quality
I think a lot of the most popular ones, motion sensor based lighting triggers etc, should really just all be integrated into HA 'properly' at some point. I've tried a bunch of the top rated blueprints along those lines and they all miss one piece of the puzzle in some way
If I am "that person" I'm not selling anything. Rofl
no, the blueprint author...
Ah, i see ๐
That is you.
I see a store and a buy link on the page, but not a lot of help for people using the blueprint
Haven't gotten around to it. Yet.
But what seemed to be the matter. Something about a legacy format?
I for one am relieved someone wrote a blueprint that got me 99.99% of the way there
It worked as soon as I removed the attribute: action from the trigger
I suggest you let them know it's set-up for non-legacy mode at least to prevent this fellow's problems
Wasn't aware of such a mode. But will update the post.
Also I woud add a condition to prevent the log from getting spammed with the Z2M null and wake triggers.
Look above, I have links to my stuff to help you out.
Well thanks to you both I now have wife-friendly wall controllers that let her do the APPARENTLY NECESSARY 'being able to turn the lights in a room on and off without taking out my phone' ๐ So much appreciated
That legacy-non legacy is a pain. It constantly trips people up and it's hard ro recognize during support calls.
I do feel the need to say; do not presume too much about why a post is structured the way it is.
I merely shared something that might be of benefit to others and just linked the store where I got it from to make it recognizable to people. ๐
That being said, any constructive criticism, like pointing out the stuff about the logs and legacy format is appreciated. ๐