Sunday, July 31, 2022

Adding custom telescope temp sensors to HomeAssistant

 

 

On recommendation from another coworker I added HomeAssistant to the mix of Pi's that automate my house.  It's an awesome tool and as a security professional I highly recommend it over cloud based alternatives but that's another blog entry!

 

This is episode 5 of our multi-part series on how I built a fully automated temperature control system for my telescope mirror.  In the previous installment - https://astromaphilli14.blogspot.com/2022/07/recording-temprature-data-to-influxdb.html - we saw that the data was being recorded in Influx and read into Grafana for 'pretty pictures and graphs'

 

Now we are going to create a second client to read the data out of Influx, HomeAssistant

 

The idea of using HomeAssistant (HASS) is that we can take logical action such as:

 

If deltaT > X ; TURN ON

Else if deltaT < Y ; SHUT OFF

Elsif ; SHUT OFF

 

Actual automation in HASS will be the next blog, but for now, let's show how to get our values into HASS!

 

 

pi@astrocart:~ $ cat /Docker/homeassistant/sensor.yaml

- platform: influxdb

  host: localhost

  username: maphilli14

  password: MYSECRET

  queries:

    - name: DeltaTemp

      measurement: '"°F"'

      value_template: '{{ value | round(1) }}'

      where: '"time" > now() - 1m'

      measurement: 'DeltaTemp'

      database: astrocarttemp

    - name: AstroCartTemp

      measurement: '"°F"'

      value_template: '{{ value | round(1) }}'

      where: '"time" > now() - 1m'

      measurement: 'AirTemp'

      database: astrocarttemp

    - name: MirrorTemp

      measurement: '"°F"'

      value_template: '{{ value | round(1) }}'

      where: '"time" > now() - 1m'

      measurement: 'MirrorTemp'

      database: astrocarttemp

    - name: OpenWeather Temp

      measurement: '"°F"'

      value_template: '{{ value | round(1) }}'

      where: '"time" > now() - 1m'

      measurement: 'OpenWeatherTemp'

      database: astrocarttemp

pi@astrocart:~ $

 

It's actually that simple!

 

This as well as some simple hacks to grafana make for some very pretty dashboards such as my current one!

 


Here's me scrolling around - https://imgur.com/vt8adSy

 

https://i.imgur.com/vt8adSy.mp4

 


Blog Archive