Since version 380.65 AsusWRT Merlin can provide information about availabe firmware update to the Home Assistant.
On the router in location /jffs/scripts You have to create a file update-notification containing:
#!/bin/sh
# Retrieve version
TMPVERS=$(nvram get webs_state_info)
VERS=${TMPVERS:5:3}.${TMPVERS:8:10}
ROUTER_IP=$(nvram get lan_ipaddr)
curl -X POST -H "x-ha-access: HASS-PASSWORD" \
-H "Content-Type: application/json" \
-d '{"state": "'$VERS'", "attributes": {"router_ip": "'$ROUTER_IP'"}}' \
http://HASS_IP:HASS_PORT/api/states/sensor.router_update
and give it permission to run:
chmod +x /jffs/scripts/update-notification
Remember to change HASS-PASSWORD, HASS_IP, HASS_PORT to the correct values.
And in Home Assistant automation:
- alias: Router Update Available Notification
trigger:
- platform: state
entity_id: sensor.router_update
action:
service: notify.html5
data_template:
title: 'New firmware version for router'
message: "There is available new firmware version {{ states.sensor.router_update.state }} for router with IP {{ states.sensor.router_update.attributes.router_ip }}."
data:
data:
tag: 'notification-router-update'
url: "https://asuswrt.lostrealm.ca/changelog"
Recently upgraded the the latest version of Merlin so I might give this a go! Would be very hand as I’ve always been way behind on latest versions due to no real notification methods! Thanks for sharing!
This does not work on my setup.
I have change HASS-PASSWORD, HASS_IP, HASS_PORT to the correct values.
and give it permission to run.
But i never get any sensor.router_update in Hass.
My router have had the yellow blinking ! for several days now, but Hass wount pick it up?
Is there any way to debug whats wrong?
Running a RT-AC68U with merlin 380.65_2 (380.65_4 is latest)