Home Assistant

languages: ennl

Home assistant is an increasingly popular open source platform for visualizing and automating your home, with a special focus on privacy.  See https://www.home-assistant.io/ for more information. 

If you are running Home Assistant or want to run Home Assistant and are interested in integrating data from Meet Je Stad, this pages provides the current available routes

Option 1 : Define a RESTful Sensor in your configuration.yaml

In Home Assistant you can define a rest sensor in configuration.yaml. See https://www.home-assistant.io/integrations/sensor.rest/ for examples and more information about the available methods and parameters. Below is an example for utilizing this rest sensor to get the measurements from a Meet Je Stad station. In this case the station is equipped with a temperature sensor and soil moisture sensors at two depths: 10cm and 40cm. In order for the script to work, replace #### with your sensor-id.

rest:
  - resource: "https://meetjestad.net/data/?type=sensors&ids=####&format=json&limit=1"
    scan_interval: 00:10:00
    sensor:
      - name: "mjs_####_humidity"
        value_template: '{{value_json[0].humidity}}'
        device_class: humidity
        state_class: measurement
        unit_of_measurement: "%"

      - name: "mjs_####_temperature"
        value_template: '{{value_json[0].temperature}}'
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"

      - name: "mjs_####_soil_moisture_10cm"
        value_template: '{{(value_json[0].extra[0]|float*0.049-5.4)}}'
        device_class: moisture
        state_class: measurement
        unit_of_measurement: "%"

      - name: "mjs_####_soil_temperature_10cm"
        value_template: '{{(value_json[0].extra[1]|float/4 -20)}}'
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"

      - name: "mjs_####_soil_moisture_40cm"
        value_template: '{{(value_json[0].extra[2]|float*0.049-5.4)}}'
        device_class: moisture
        state_class: measurement
        unit_of_measurement: "%"

      - name: "mjs_####_soil_temperature_40cm"
        value_template: '{{(value_json[0].extra[3]|float/4 -20)}}'
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"

       - name: "mjs_####_pm2.5"
         value_template: '{{(value_json[0].pm2.5)}}'
         device_class: pm25           
         state_class: measurement
         unit_of_measurement: "µg/m³"
         
       - name: "mjs_####_pm10"
         value_template: '{{(value_json[0].pm10)}}'
         device_class: pm10         
         state_class: measurement
         unit_of_measurement: "µg/m³"

      - name: "mjs_####_battery_voltage"
        value_template: '{{value_json[0].battery}}'
        device_class: voltage
        state_class: measurement
        unit_of_measurement: V

Below is the output of the code when visualizing the entities in the dashboard. In this case for sensor 2003. 

Home_assistant.png

This approach is flexible. If you want to define custom sensors, you can simply get them from the comma-separated 'extra' field using: value_json[0].extra[n], where n is the position of the target value. Starting with position 0. In the example above we could define another sensor: PV_voltage, which is the 5th value in the extra field, i.e. position 4, as following

      - name: "mjs_####_PV_voltage"
        value_template: '{{(value_json[0].extra[4]|float/1000)}}'
        device_class: voltage
        unit_of_measurement: V

Option 2 : Use the HACS Integration HassMeetjestadSensor

This Integration was written by chandrashekar-nallamilli and can currently be used to get temperature and humidity data from Meet Je Stad Stations. It can be found on github: https://github.com/chandrashekar-nallamilli/HassMeetjestadSensor 

To install this integration you need to have Home Assistant Community Store (HACS) installed. If you do not have HACS installed, follow their documentation on https://hacs.xyz/

Contribute

If you have additions to the information or code on this page. Send an e-mail to meedoen@meetjestad.net. Of course you can directly contribute to the github integration of chandrashekar-nallamilli by adding issues or doing pull requests.