Right now I’m reading two values of a html page of the loudness meter. The URL is: http://192.168.1.101/audio_set?monitor=*&status=? and it will respond with the following code
monitor=*&status={“company”:“XXX”,“location”:“”,“dba”:718,“dbc”:825,“peak”:825,“leq1”:{“enable”:1,“filter”:“a”,“timeunit”:“m”,“timespan”:60,“db”:716},“leq2”:{“enable”:1,“filter”:“a”,“timeunit”:“s”,“timespan”:1,“db”:717},“audio”:{“left”:-442,“right”:-438},“reduction”:{“max”:200,“total”:0,“multiband”:[0,0,0,0,0,0,0,0,0,0]},“limiter”:{“allowed_levels”:{“a”:{“level”:1000},“c”:{“level”:1150},“peak”:{“level”:1250}},“time_till_sanction”:20,“time_left_till_sanction”:20,“sanction_time”:20,“sanction_time_left”:0,“mode”:“live”},“events”:,“serial_number”:“XXXXX”,“cpu_temp”:“48.8”,“cpu_uptime”:“101:20%20min”,“firmware”:“3.0X”,“update_available”:0,“sanction”:0,“overload”:0,“reduce”:0,“detect”:0,“correlation”:285}
I read the DBA and DBC values with the folling code (created with generous help from the forum)
rest:
scan_interval: 10
resource: "http://192.168.1.101/audio_set?monitor=*&status=?"
sensor:
- name: "dbamessung"
state_class: measurement
value_template: >-
{% set j = ((value).split("status="))[1]|from_json %}
{{ j['dba']/10 }}
unique_id: dbamessungid
- name: "dbcmessung"
state_class: measurement
value_template: >-
{% set j = ((value).split("status="))[1]|from_json %}
{{ j['dbc']/10 }}
unique_id: dbcmessungid
Now I also want to read the dba leq60 (value over 60minutes), it is in the code
“leq1”:{“enable”:1,“filter”:“a”,“timeunit”:“m”,“timespan”:60,“db”:716},
the value is 716, i would need it as 71.6 (see in the code above /10), but i don’t know how to read it as i cannot identify it directly as dba or dbc, it is only db.
Any hint on how to do that would be greatly appreciated. Thank you in advance.