I’m pretty new to this so excuse me if this is easy. I’ve been working on it for days to get to this point. I am getting temperature information from Dynalite Antumbra light switches. The official Dynalite integration which I am using for the lights does not have temperature support.
Dynalite has an ethernet gateway that I can POST to and get responses about the temperature.
The post looks like:
http://192.XXX.XXX.XXX/GetDyNet.cgi?a=11&TEMPERATURE
Where a=11 Is the switch in Dynalite area 7
Response looks like:
t=21.46
which is 21.46 degrees celcius
I have this working - but only just. Currently using 7 switches but would like to use more.
2 parts to my question.
-
How can I better structure my code so it isn’t so verbose? Can I loop it or take an input file?
-
The ethernet gateway doesn’t seem capable of responding to simultaneous requests and fails to respond to some on the first try. It takes a long time to create the entities after reboot. (This is why I have varied the scan intervals)
My code:
(Have only included 2 switches - but you get the idea. Would be very long for 20+ switches).
sensor:
# Kids study temperature
- platform: rest
name: Kids Study Temp
resource: http://192.XXX.XXX.XXX/GetDyNet.cgi?a=10&TEMPERATURE
value_template: "{{ value.split('=')[1] | float }}"
scan_interval: 177
unit_of_measurement: '°C'
# Family TV room temperature
- platform: rest
name: Family TV Temp
resource: http://192.XXX.XXX.XXX/GetDyNet.cgi?a=41&TEMPERATURE
value_template: "{{ value.split('=')[1] | float }}"
scan_interval: 191
unit_of_measurement: '°C'
Any tips or better ideas about the approach?