Dear Community
HA
I started to run Home Assistant in our local cultural venue and I want to integrate the current loudness measurements into HA, so everyone working is able to check that we are within the legally allowed bounds. Home Assistant 2023.12.3 is deployed as a Docker install on a Synology NAS in the local network where also the loudness measurement device is situated. This device can either output the dBA to an external display or is accessible through a webserver that runs on the machine itself. Due to legal situation, i cannot access the webserver on the device itself as the machine is responsible for legally binding loundness measurement.
It upgrades the loudness every second on the homepage that we cann access through http://192.168.1.101/monitor.html
With scrape I wanted to integrate it in my HA. For visualisation, the simple homepage looks like follows (the dBA value I want to scrape).
with the following CSS selector:
#level-dba > span:nth-child(1)
This selector doesn’t work. I then found out in other threads that it probably is the case, that i cannot scrape that selector, because the value is loaded with an java script over the address:
http://192.168.1.101/audio_set?monitor=*&status=?
This address is updated every second and has the following content
monitor=*&status={"company":"","location":"","dba":603,"dbc":814,"peak":814,"leq1":{"enable":1,"filter":"a","timeunit":"m","timespan":60,"db":638},"leq2":{"enable":1,"filter":"a","timeunit":"s","timespan":1,"db":603},"audio":{"left":-797,"right":-818},"reduction":{"max":200,"total":0,"multiband":[0,0,0,0,0,0,0,0,0,0]},"limiter":{"allowed_levels":{"a":{"level":1000},"c":{"level":950},"peak":{"level":980}},"time_till_sanction":20,"time_left_till_sanction":20,"sanction_time":20,"sanction_time_left":0,"mode":"live"},"events":[],"serial_number":"6700","cpu_temp":"42.7","cpu_uptime":"28:21%20min","firmware":"3.0T","update_available":0,"sanction":0,"overload":0,"reduce":0,"detect":0,"correlation":86}
What I want to do is have the first value after dba (in this case 603) updated every second in homeassistant and changed from 603 to 60 (the 3 is the decimal value, so 60.3 dba). But here I’m stuck. Can I do that with scrape or with rest or should I use another integration?i
edit:
I tried to scrape the whole html code into HA with the following yaml config:
scrape:
- resource: http://192.168.1.101/audio_set?monitor=*&status=?
sensor:
- name: "db-messung"
select: "body"
But to no success.
Best and thank you for any inputs and hints, bluecrimson