Home Assistant Integration using Webhooks #1991
Replies: 4 comments 3 replies
-
|
Instead of defining the state and and unit of measurement couldn't you use the new |
Beta Was this translation helpful? Give feedback.
-
|
This integration is using the speedtest webhook, and I don't see that data being sent as part of the json body. This is what I receive in HA when the webhook is called: Also, parsing a string with uom into the HA sensor values is harder than using the int values, afaik. |
Beta Was this translation helpful? Give feedback.
-
|
Nice...works well...how would I round the upload/download numbers, right now they are showing at like 15 decimals :) That's a lot of numbers. The nearest whole or hundredth of a percent would be more than adequate. |
Beta Was this translation helpful? Give feedback.
-
|
The webhook data seems to have changed in the meantime, I had to update the trigger a little to make it work. - trigger:
- platform: webhook
webhook_id: speedtest-tracker
sensor:
- name: "Speedtest Download"
state: "{{ (trigger.json.download / 1024 / 1024) | round(2) }}"
state_class: measurement
unit_of_measurement: "Mbps"
unique_id: speedtest-download
- name: "Speedtest Upload"
state: "{{ (trigger.json.upload / 1024 / 1024) | round(2) }}"
state_class: measurement
unit_of_measurement: "Mbps"
unique_id: speedtest-upload
- name: "Speedtest Ping"
state: "{{ trigger.json.ping | round(2) }}"
state_class: measurement
unit_of_measurement: "ms"
unique_id: speedtest-ping
- name: "Speedtest Packet Loss"
state: "{{ trigger.json.packet_loss }}"
state_class: measurement
unit_of_measurement: "%"
unique_id: speedtest-packet-loss
- name: "Speedtest ISP"
state: "{{ trigger.json.isp }}"
unique_id: speedtest-isp
- name: "Speedtest Result URL"
state: "{{ trigger.json.url }}"
unique_id: speedtest-result-url |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if this has been mentioned, but if you want to integrate the speedtest-tracker with Home Assistant there's a super simple way to do it using webhooks.
The only thing you need to change are the parts in <>. And create a unique webhook to link the two services together.
You'll configure a webhook in speedtest-tracker under notifications with the following URL:
https://<homeassistant>:<port>/api/webhook/<unique-webhook>Then you add some template sensors to your HA config.yaml, like so:
And that's it! After restarting HA, run a speedtest and you'll start seeing the data show up in HA.
*Edited to add the state_class so you get measurement statistics calculated in HA
Beta Was this translation helpful? Give feedback.
All reactions