I’m having a problem with an automation that won’t run with the condition I want, and I don’t know why.
I have verified if I comment out the “condition” it does run, but I can’t get it to run with the “condition” on ISP=“Atlantic Broadband”.
Goal: If the internet speed is slow, and its on my primary ISP, re-run the speedtest after ~10 minutes (in case it was a fluke).
Relevant MQTT data sample:
{"type":"result","timestamp":"2021-02-23T15:24:19Z","ping":{"jitter":5.726,"latency":13.298},"download":{"bandwidth":116986737,"bytes":1443489480,"elapsed":13202},"upload":{"bandwidth":6719752,"bytes":24197528,"elapsed":3602},"packetLoss":0,"isp":"Atlantic Broadband","interface":{"internalIp":"24.153.32.24","name":"igb0","macAddr":"A0:36:9F:07:4C:D0","isVpn":false,"externalIp":"24.153.32.24"},"server":{"id":14335,"name":"PBW Communications, LLC","location":"Herndon, VA","country":"United States","host":"speedtest.leadmon.net","port":8080,"ip":"38.103.8.130"},"result":{"id":"b7ca89fa-7c45-4d10-a175-228254c605a8","url":"https://www.speedtest.net/result/c/b7ca89fa-7c45-4d10-a175-228254c605a8"}}
Relevant MQTT sensors:
# ISP
- platform: mqtt
name: "ISP Speedtest.net"
unique_id: "speedtest_net_isp"
state_topic: "homeassistant/sensor/speedtest-net"
value_template: "{{ value_json.isp }}"
# Download Speed
- platform: mqtt
name: "Download Speed Speedtest.net"
unique_id: "speedtest_net_download_speed"
state_topic: "homeassistant/sensor/speedtest-net"
unit_of_measurement: 'Mb/s'
value_template: "{{ (value_json.download.bandwidth | float) * 8 / 1000000 | round(2) }}"
icon: mdi:speedometer
# Upload Speed
- platform: mqtt
name: "Upload Speed Speedtest.net"
unique_id: "speedtest_net_upload_speed"
state_topic: "homeassistant/sensor/speedtest-net"
unit_of_measurement: 'Mb/s'
value_template: "{{ (value_json.upload.bandwidth | float) * 8 / 1000000 | round(2) }}"
icon: mdi:speedometer
My automations:
NOTE: The script and hourly one work, they are included only for reference. The “Re-Run” one fails when condition is present.
# Call script which publishes readings to MQTT
shell_command:
speedtest_net_run_test: '/config/speedtest-net/mqtt_pub.sh'
automation:
# Run the test on startup, and hourly
- alias: 'Speedtest.net Run Test'
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
minutes: 0
action:
service: shell_command.speedtest_net_run_test
# Re-run test when speeds are slow on primary ISP
- alias: 'Speedtest.net Re-Run Test'
trigger:
- platform: time_pattern
minutes: '/2'
# ^ For testing, run it a LOT so I can see if the condition works
- platform: numeric_state
entity_id:
- sensor.speedtest_net_download_speed
below: 500
for: '00:10:00'
- platform: numeric_state
entity_id:
- sensor.speedtest_net_upload_speed
below: 25
for: '00:10:00'
condition:
- condition: state
entity_id: sensor.speedtest_net_isp
state: 'Atlantic Broadband'
action:
service: shell_command.speedtest_net_run_test
Dev-Tools sensor state:
Possibly relevant, I also can not find it by searching the “state” filter, as soon as I hit the letter “t” in “Atlantic” it shows zero results.
I don’t understand why, but I wonder if this may be related to my condition failing?
I’m at a loss how to diagnose this.
UPDATE: BUG?
EDIT: I think this may be a bug related to case-sensitivity after trying something else: