Offline Zigbee device notifications in Zigbee2MQTT

  Рет қаралды 13,058

Home Automation Guy

Home Automation Guy

4 ай бұрын

Sometimes Zigbee devices drop off the network. How do you know that this has happened without waiting for an automation to fail?
❤️ Found this video useful and want to support the channel? I'd love a donation at paypal.me/homeautomationguy
Links:
Full article for this video: www.homeautomationguy.io/blog...
Improving your Zigbee network reliability (Rock Solid Zigbee): • Improve Zigbee network...

Пікірлер: 95
@StevenMackenzie
@StevenMackenzie 4 ай бұрын
Great to see you sharing some Zigbee2MQTT content - I'd been looking at the disabled Last Seen attributes in HA and wondering what useful things I could do with them
@KeithConley
@KeithConley 4 ай бұрын
This is a timely video as I've even troubleshooting some Zigbee availability issues on my network. I'll be checking out your article for sure.
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Check out the other video I made, linked in the description, which gives more tips on how to make your network more stable and reliable.
@waynenocton
@waynenocton 4 ай бұрын
This video is absolute gold!
@gregtheduck3441
@gregtheduck3441 4 ай бұрын
Your videos are useful, simple and to the point. Thank you, well done for your work 👍
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Thank you so much ❤️
@yousaf.saleem
@yousaf.saleem 4 ай бұрын
how to do the same in zha? currently, I have only one zigbee device and I am using zha will migrate to z2m when I am using more devices
@eduardosaavedra2413
@eduardosaavedra2413 4 ай бұрын
Thanks a lot Alan, very helpful :). BTW if by any chance activating the last_seen flag doesn't work for you by modifying z2mqtt config file, you can always do that by going to the settings -> entities menu, and the filter by "last_seen" and integation = MQTT. Then you can just select all, and enable the entity ;). Keep up the good work!
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Thanks for the tip! I didn't know that!
@colincheng6674
@colincheng6674 2 ай бұрын
I wish I had read this earlier. The config file did not work for me and so I tediously enabled the last_seen entity 56 times.
@bobellison2547
@bobellison2547 4 ай бұрын
I found this really useful. Thanks very much!
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Glad it was helpful!
@peterwurst45346
@peterwurst45346 4 ай бұрын
Thanks for the great content, this is something I have already missed in my smart home. Sad it's no default but with this video easy to achieve
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Glad it was helpful!
@gerryf7015
@gerryf7015 4 ай бұрын
Excellent video, presentation, and documentation. Really upped the game. Thanks.
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Much appreciated!
@Joseph-ko2kl
@Joseph-ko2kl 4 ай бұрын
What a great Idea! This is super helpful.
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Thank you!
@Novation681
@Novation681 2 ай бұрын
This is really great and works fine, thanks! Any chance you can filter out sensors in your script, in the similar fashion that you do in the blueprint?
@the_smart_home_maker
@the_smart_home_maker 4 ай бұрын
Nice video! Would be great to extend this to ZHA
@CheaperSmartHomes
@CheaperSmartHomes 4 ай бұрын
Love your work
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Naw thanks 🙏
@emms-place
@emms-place 4 ай бұрын
Awesome video. Now I don't have to check every morning if there are any offline devices
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Glad it was helpful!
@davidgeorge4
@davidgeorge4 4 ай бұрын
Great video, been looking for something to help track possible issues with my network and this is what I needed! Especially the template sensor, really useful. Two suggested alterations to the final line of the template are to new line separate the list and truncate the output: {{ result.sensors | join(' ') | truncate(254, True) }} The first is more cosmetic to make each zigbee device show on its own line, the second is fixes an issue where if the output is longer than 255 chars the sensor errors to 'unknown' instead of showing anything. This would likely happen if 5+ devices are offline. I also edited the final automation to send a positive notification if everything is online using an if condition on the template sensor, if no devices are offline the template is empty: {% if not states('sensor.offline_zigbee_devices') %} All Zigbee Devices Online! {% else %} The following Zigbee Devices are offline: {{ states('sensor.offline_zigbee_devices') }} {% endif %}
@xbmcnut
@xbmcnut 4 ай бұрын
Do you have that full code online anywhere David?
@davidgeorge4
@davidgeorge4 4 ай бұрын
@@xbmcnut If you mean the template sensor, its identical to what is in the video (and can be copied in the blog post), except the final line, which is replaced by {{ result.sensors | join(' ') | truncate(254, True) }} As for the automation, that is also identical to the video and blog post except for what I posted in my original comment. My full automation is below, just change sensor.offline_zigbee_devices to whatever your template sensor is called, and notify.phone to whatever device you want to send the notificaiton to. alias: Notify Change in Offline Zigbee Devices description: >- Send a notification to a device when 1 or more zigbee devices are deemed to be offline, or all come back online. trigger: - platform: state entity_id: - sensor.offline_zigbee_devices condition: [] action: - service: notify.phone metadata: {} data: message: |- {% if not states('sensor.offline_zigbee_devices') %} All Zigbee Devices Online! {% else %} The following Zigbee Devices are offline: {{ states('sensor.offline_zigbee_devices') }} {% endif %} mode: single
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Those are really great additions to the template sensors. I'm gonna steal those and update my article! (With full credit to you of course) ❤️
@heiaheiaheiahei
@heiaheiaheiahei 4 ай бұрын
Thanks!
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Wow! Thank you so much for your support 🙏
@EsotericArctos
@EsotericArctos 4 ай бұрын
The 10 minute ping is only activated if the Zigbee device doesn't check in during that time. Most powered devices checkin more regularly than that, so it would only be for odd devices that the ping would be triggered for. It would't really affect bandwidth much. Powered devices just sending their current status is classed as a checkin. 🙂
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Thanks for the clarification! 🙏
@Ellghee
@Ellghee 4 ай бұрын
Thanks
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Thank you so much for your donation! I really appreciate the support 🙏
@Kliptrech26Rg001
@Kliptrech26Rg001 4 ай бұрын
your video helped me a lot, I appreciate a lot for privacy on the mobile device and try to avoid data collection from Google other Bigtechs, I saw that you use the Pixel 6, in the case of Home Assistant we know that it has some trackers the official version, the, which version of the mobile APP do you use Home Assistant to avoid trackers and data collection from bigtechs (type google, amazon, etc) ? Or do you use the standard version of Home Assistant on mobile ?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
I use the standard version of the app on my mobile. I am sure it tracks some of my usage, but I use so many Google products that this is unavoidable for me. I'm trying to limit the amount that I am tracked, rather than try to eliminate it entirely.
@colincheng6674
@colincheng6674 4 ай бұрын
I couldn't agree with you more - there is absolutely no reason to regress back to caveman behaviour! We need to reclaim our right to be pathetically lazy! All joking aside, this is a great resource for knowing when our devices go offline. I had previously been obsessively checking on a daily basis to see what devices are offline - this will help address these issues immediately. Perhaps you might create a separate video on why ZigBee devices go offline and how to prevent this?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Take a look at the "Creating a rock solid Zigbee network" video which is linked in the description. It mentions the top reasons why they go offline.
@JamesMyatt1
@JamesMyatt1 4 ай бұрын
I assume that the new entity labels will help with these sorts of automations and templates (soon)
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Possibly! I'm still learning the best way to play with these.
@StevenMackenzie
@StevenMackenzie 4 ай бұрын
It's very frustrating when devices drop off the network for no obvious reason (like Aqara THP sensors - where do they keep going?) - I have a theory that I might have one or two unreliable router devices on my network, or compatibility between end devices and particular routers. I'd love to replace the unreliable routers in my network - if I could tell what they were! It would be really cool to see how to add "last connected router device" in your notifications? If I keep seeing the same router in the missing device notifications then I know something's not right with it.
@MrCBRXX1100
@MrCBRXX1100 4 ай бұрын
Nice tip and video. The automation works as expected. But it notifies me, when devices go offline. Is it possible to make an automation, which says - hey - "Bedroom lamp" went online again - or something similar?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
You can add this to your notification automation to alert you when all devices come back online, but not each one individually without doing way more code magic: {% if not states('sensor.offline_zigbee_devices') %} All Zigbee Devices Online! {% else %} The following Zigbee Devices are offline: {{ states('sensor.offline_zigbee_devices') }} {% endif %} Props to @davidgeorge4 for this extra piece of logic elsewhere in the comments.
@deansiddall3729
@deansiddall3729 4 ай бұрын
How has the aqara h1 been performing. Also how did you get around the 2 switching, was it software only?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
They've been performing great! I have to use Home Assistant to "Simulate" the two way switching with Automations, and that is a pain. But I honestly never use the switches, all the lights are triggered by automations. I left the two way switching cables in the walls in case I move out or want to replace the switches in future.
@deansiddall3729
@deansiddall3729 4 ай бұрын
@@HomeAutomationGuy Thanks for the reply. i have the switches but the 2 way situation is really annoying and would like dumb switches to work still for WAF. Also had to get a hub because HA didn't want to play ball, decoupled mode seems to just make them not work. love your videos, keep them coming.
@louisviciedo
@louisviciedo 4 ай бұрын
Great video only MQTT not ZHA?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
I am unfortunately not sure how to make it work with ZHA as I don't use it in my smart home. If someone knows how hopefully they share it in the comments!
@dinth
@dinth 2 ай бұрын
Sorry but does changing timeout from 10 to 20 min in advanced Availability settings actually changes the frequency the devices are being pinged?
@HomeAutomationGuy
@HomeAutomationGuy 2 ай бұрын
I think so? The Zigbee2mqtt documentation seems to suggest that
@edcoppen
@edcoppen 4 ай бұрын
Awesome video! Can the code on the Z2MQTT yaml file go anywhere within it please?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Almost. It has to be indented correctly and not nested under another important thing. I'd try and stick it right at the end to be safe.
@Girbie1973
@Girbie1973 3 ай бұрын
I ran into an interesting issue: I created the template helper as per your instructions. However, I have currently quite a number of devices unavailable (I know the cause, so that itself is not an issue). The template gives now the following error: Invalid state with length 1181. State max length is 255 characters. Clearly it is time to repair my zigbee network...
@HomeAutomationGuy
@HomeAutomationGuy 3 ай бұрын
I recently updated the article with some feedback from another commenter on my video to fix this. If you change the last line you can truncate it to fit. You should see this updated on the linked article too. {{ result.sensors | join(' ') | truncate(254, True) }}
@Warhoon
@Warhoon 3 ай бұрын
For some reason the template sensor isn't working for me. Z2MQTT shows all the "last seen" attributes. When I paste your code into the new template sensor it seems to parse ok. The preview in the template sensor yaml box shows "Domain: sensor" then two entities that don't make sense to me: "sensor.node_5_last_seen" and a second item "sensor.plug_in_appliance_module_last_seen" which is a Z-Wave device. Does anyone have any suggestions?
@Warhoon
@Warhoon 3 ай бұрын
More info: z2MQTT reports nothing offline. When I deliberately unplug a router device, it shows up as unavailable in z2MQTT but not in the template sensor preview.
@trevsweb
@trevsweb 4 ай бұрын
instead of comma seperation in the list how can I set it as separated lines? can I use html?
@B-a_s-H
@B-a_s-H 4 ай бұрын
I think you can use join(' ') to get seperate lines. Also HTML should be possible, but I think Jinja auto-escapes HTML (check the docs on that). Answering from phone, so not able to test atm.
@mariopalma3802
@mariopalma3802 4 ай бұрын
try this in the notify, w/o changing anything else: message: >- "The following Zigbee Device(s) are Offline: - " {{ states('sensor.z2m_offline_devices') |replace(", "," - ") }}
@Ellghee
@Ellghee 3 ай бұрын
I do not get your helper to work, I cut and past from your blog. It shows unavailable. Is the issue that I run 24 hrs clock? If so how do I modify it?
@Ellghee
@Ellghee 3 ай бұрын
@@HomeAutomationGuy This ended up under my question, I dont´t think it was intended as an answer to me??
@HomeAutomationGuy
@HomeAutomationGuy 3 ай бұрын
Nope! I typed into the wrong box sorry 🤦‍♂️ I don't think a 24 hour clock should cause any problems. I'm sorry I don't know why it's not working
@Ellghee
@Ellghee 3 ай бұрын
@@HomeAutomationGuy Whe I stated adding the units one by one, they showed up!
@ryanbell85
@ryanbell85 23 күн бұрын
Do you have a favorite zigbee repeater?
@HomeAutomationGuy
@HomeAutomationGuy 22 күн бұрын
All my powered Zigbee devices work as repeaters, I don't use a specific device as a repeater.
@RichDurso
@RichDurso 3 ай бұрын
Script is working fine, I get notifications. However, upon HA restart I get some ugly stack traces from the script. Too long to cut & paste here, but they look like"2024-04-17 14:02:06.341 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{% set result = namespace(sensors=[]) %}" script need a bit more filtering? or default timestamp value?
@RichDurso
@RichDurso 3 ай бұрын
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2047, in forgiving_as_timestamp raise_no_default("as_timestamp", value) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1849, in raise_no_default raise ValueError( ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{% set result = namespace(sensors=[]) %}
@Whoop0
@Whoop0 4 ай бұрын
That's a loooot of zigbee devices. I'd be interested in how you've resolved the problem with Zigbee lights, where upon turning them on they revert to their previous state (temperature/brightness) before transitioning to their new state so you get some dodgy flashing lights initially.
@BeardAndCap
@BeardAndCap 4 ай бұрын
Not entirely sure if I understand what you are running into, but I use the HACS integration "adaptive lighting" to automatically change the color temperature of my lights. I both wifi and Zigbee lights from multiple vendors (wled, Philips, ikea, Aqara, MiBoxer), and so far have not run into any major issues.
@Whoop0
@Whoop0 4 ай бұрын
@@BeardAndCap I use adaptive lighting too, that works awesome if you leave your lights on through the day. However if you turn them off, then on again hours later they will start with the previous colour before adaptive lighting kicks in and changes to the new
@BeardAndCap
@BeardAndCap 4 ай бұрын
@@Whoop0 Ahh, yes that is true. However for me the "old state" always transitions to the new state quite smooth without any flashes. On occasion I do run into a unresponsive light where the light won't turn off (forcing me to do a "turn off", "turn on") before the light is responsive again.
@Whoop0
@Whoop0 4 ай бұрын
@@BeardAndCap even if smooth it’s pretty horrible if you for example turn on at 7am then next 11pm, blinded before it transitions. Wish I could work out how to fix, native Hue doesn’t have this problem.
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
My Hue lights and Candeo zigbee dimmers don't seem to do that. I use the light.turn_on service in Home Assistant, and assign a brightness level in that.
@mrxmry3264
@mrxmry3264 4 ай бұрын
I have a weird problem: every 3 hours 2 of my zigbee sensors become unavailable and then come back about an hour later, and I have no idea why they're doing that. I've ruled out EM interference because a) they don't drop out at the same time and b) this problem does not affect any other zigbee devices. Low batteries can be ruled out too because both of them report 100% battery.
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
That's frustrating! I would be careful about ruling out battery, because I often have things report 100%, and then the next day report 2%, and then 20% etc. Try replacing the battery in one of them to see if that fixes it. Otherwise I'd see if you can add a router device nearby, like a smart bulb or something else that is mains powered, to see if strengthening the network makes it more reliable.
@mrxmry3264
@mrxmry3264 3 ай бұрын
@@HomeAutomationGuy i found out what it was. i set the timeout for battery powered devices to 2 hours but if nothing changes the sensors only report in every 3 hours. so after 2 hours home assistant considered them unavailable even though they were just doing their normal thing. now i've set the timeout to 4 hours, and they work normally again. but this doesn't explain why my synology add-on keeps reporting its entities as unavailable (and this one doesn't come back by itself).
@samueldaniels5223
@samueldaniels5223 4 ай бұрын
My template sensor isn’t showing anything, and I have devices offline. What have I done wrong?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
Unfortunately that's hard for me to help with since I'm not able to see your environment or devices. I'd try playing with the template in Developer Tools in Home Assistant and seeing if you can get results in there. Sorry I can't be more helpful!
@samueldaniels5223
@samueldaniels5223 4 ай бұрын
@@HomeAutomationGuy I figured it out. Apparently over the last couple of years both the last seen entity and link quality of ZigBee devices has been disabled by default in HA, so you need to enable them in your entities list by filtering it by disabled and then using those search options. Works like a charm now. Thanks!
@samueldaniels5223
@samueldaniels5223 3 ай бұрын
@@HomeAutomationGuy - I’ve got the sensor working but any idea why I get bombarded every couple of days with the notification? I get a bunch of devices saying they’re unavailable all at once. What might be happening within might network to cause that? They don’t go offline, they just say they’re unavailable but that changes once they triggered again.
@Matte_olo
@Matte_olo 4 ай бұрын
In Diagnostic I don't have "Last Seen" why?
@spug68
@spug68 4 ай бұрын
I noticed in Mr. Groch Blueprint, needed to set to ISO8601_Local, and then I needed to double check when I added the yaml lines to the Configuration.yaml for zigbee2mgtt that it was saved. Restarted Zigbee2mqtt and the sensor is now there :) Hope that helps!
@Matte_olo
@Matte_olo 4 ай бұрын
It works thanks
@rodrigomarins273
@rodrigomarins273 4 ай бұрын
Hi! Very nice. I tried but cant conclude. The action message is giving error. Any tips?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
What's the error?
@rodrigomarins273
@rodrigomarins273 4 ай бұрын
@@HomeAutomationGuy I tried to follow your video and blog but got confused in the "Then" part of your automation. I didn't understand how to do this part. I tried to copy the code you put in the video (replacing the name of the ID). However, some kind of syntax error occurred: "template value should be a string for dictionary value @ data['message']. Got None". Could you explain this part again, please?
@HomeAutomationGuy
@HomeAutomationGuy 4 ай бұрын
@@rodrigomarins273 Sorry about that, I've edited the post to try and make it clearer. You’ll need to select the right service from the list for your Home Assistant mobile app notification service to send the notification, and then in the message part you’ll need to make sure you edit the {{ states(‘sensor.z2m_offline_devices’) }} part to use the sensor you created earlier. I hope this helps
@rodrigomarins273
@rodrigomarins273 4 ай бұрын
@@HomeAutomationGuy Thanks so much! 😀🙏
Fixing my Zigbee with a network Zigbee coordinator
10:41
Home Automation Guy
Рет қаралды 42 М.
THIS IS IT!! This Is The One!! : LinknLink Super Gateway
13:27
Paul Hibbert (Hibbert Home Tech)
Рет қаралды 86 М.
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН
I'm Excited To see If Kelly Can Meet This Challenge!
00:16
Mini Katana
Рет қаралды 31 МЛН
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 2,4 МЛН
Smart Home Protocols Explained
18:25
Home Automation Guy
Рет қаралды 149 М.
ZHA or Zigbee2MQTT - that's the question now!
29:03
BeardedTinker
Рет қаралды 33 М.
Improve Zigbee network performance and stability with these 3 tips
11:41
Home Automation Guy
Рет қаралды 172 М.
Home Assistant Features you didn't know EXISTED
8:34
Let's Automate
Рет қаралды 14 М.
15 Home Assistant Tips You MUST Do
14:28
Everything Smart Home
Рет қаралды 359 М.
Easy Zigbee2MQTT Dongle Migration - Sonoff USB to SLZB-06 Ethernet
29:35
Every Developer Needs a Raspberry Pi
27:27
Sam Meech-Ward
Рет қаралды 136 М.
3 августа 2024 г.
0:18
~ромашка мико~
Рет қаралды 1,2 МЛН
Inside out 2 hard color game
0:14
Nazar family
Рет қаралды 21 МЛН
ДОМАШНИЙ ПВЗ @DetyaBoga
0:21
KINO KAIF
Рет қаралды 6 МЛН
Черёмуха во рту вяжет
0:11
Pavlov_family_
Рет қаралды 3,2 МЛН