May 03, 2020

HomeKit with "ANY" temperature source

From AppleWatch
As long as it's possible to retrieve information, in some way, from a sensor OR a website/webserver, with temperature information, it's possible to show it in HomeKit with HomeBridge(HB).

In this post NodeRed(NR) is retrieving the temperature from Your selected source and is also acting as the WEB endpoint for the HB  "homebridge-http-temperature" plugin.

In my case I wanted an outside temperature so used the measurements from our Davis Weather station and their JSON REST API but it could for example be Your Raspberry CPU temp or showing the speed of Your Internet connection.


In the NR flow example the temperatures are retrieved from flow context. So add Your own logic retrieving Your temperatures, at chosen intervals, and update the flow context "temp1" and "temp2".



Install the  "homebridge-http-temperatureplugin and setup the config looking like below. The URL:s are referring to the endpoints You just set up in NR. Changed so the hostname, "home", matches Your setup.

"accessories": [
        {
            "accessory": "HttpTemperature",
            "name": "Temp outside1",
            "url": "http://home:1880/temp1",
            "http_method": "GET",
            "field_name": "Temperature"
        },
        {
            "accessory": "HttpTemperature",
            "name": "Temp outside2",
            "url": "http://home:1880/temp2",
            "http_method": "GET",
            "field_name": "Temperature"
        }
    ]

Restart HomeBridge and check the result in Your Home app.

There are other HomeBridge temperature http plugins available, also handling humidity, so just Google with "homebridge temperature http" or using NPM.

2 comments:

  1. This worked perfectly for grabbing the current temperature from my Cumulus MX server running on a Pi, which offers a GET API endpoint (returns JSON). Thank you for the tutorial! This Homebridge newbie appreciates it.

    ReplyDelete
    Replies
    1. Thanks ! Since you using Davis weather station check this https://pysselilivet.blogspot.com/2017/01/install-weather34-with-weatherlink.html

      Delete

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !