How to add Pimoroni Enviro/Weather sensors

For those of you looking to use the new Pimoroni enviro boards and integrate with HA here’s what I did:

I have a RaspPi4 running Home Assistant in docker. I have assigned this a static IP address because both the MQTT integration and the Enviro board require static IPs

Install the mosquitto MQTT broker on the Pi

Add the MQTT integration to HA

Provision your enviro board as per the pimoroni instructions using the MQTT option.

You can then use the MQTT integration to then listen to your enviro topic and see the information being posted. However this won’t be added as sensors via MQTT to do this I added the following to my configuration.yaml:

mqtt:
  sensor:
    - name: "Outside Temperature"
      state_topic: "enviro/shed-sensor"
      value_template: "{{ value_json.temperature }}"
      unit_of_measurement: "°C"
      state_class: "measurement"
      unique_id: "sensor.shed-sensor.temp"
    - name: "Outside Humidity"
      state_topic: "enviro/shed-sensor"
      value_template: "{{ value_json.humidity }}"
      unit_of_measurement: "%"
      state_class: "measurement"
      unique_id: "sensor.shed-sensor.humidity"
    - name: "Outside Pressure"
      state_topic: "enviro/shed-sensor"
      value_template: "{{ value_json.pressure }}"
      unit_of_measurement: "mbar"
      state_class: "measurement"
      unique_id: "sensor.shed-sensor.pressure"

Note that the MQTT messages from the enviro are JSON formatted so you need to extract the value you need for each sensor. Also by providing a unique ID for each this means you can use the GUI to set things like Icons etc.

1 Like

Hello

This was a nice project. I have got the pi with the pimoroni board set up with a static ip adress. I have the MQTT broker set up on my Home assistant. Both the broker and the integration.
I just can`t find the instructions how to send the mqtt meassages from the weather-pi. Do you know where I can find these instrustions?

I’m not sure if this has changed with a pimoroni update, but after some trial and error I found that because the “readings” heading is published on the mqtt the value template needs to be like this:


mqtt:
  sensor:
    - name: "Indoor Temp"
      state_topic: "enviro/enviroindoor"
      value_template: "{{ value_json.readings.temperature }}"
      unit_of_measurement: "°C"
      state_class: "measurement"
      unique_id: "sensor.pimo.temp"
    - name: "Indoor Humidity"
      state_topic: "enviro/enviroindoor"
      value_template: "{{ value_json.readings.humidity }}"
      unit_of_measurement: "%"
      state_class: "measurement"
      unique_id: "sensor.pimo.humidity"
    - name: "Indoor Pressure"
      state_topic: "enviro/enviroindoor"
      value_template: "{{ value_json.readings.pressure }}"
      unit_of_measurement: "mbar"
      state_class: "measurement"
      unique_id: "sensor.pimo.pressure"
    - name: "Indoor Air Quality"
      state_topic: "enviro/enviroindoor"
      value_template: "{{ value_json.readings.aqi }}"
      unit_of_measurement: "%"
      state_class: "measurement"
      unique_id: "sensor.pimo.aqi"
      

Hello - I’ve got a more basic problem, see here: Mosquitto - no data seen in logs (but can log in) - i.e., I cannot see the json data coming into HA.

Actually, using the listener, I can see the data. Integrations/MQTT->configure, Listen to a topic, Listen to “#” and 'start listening.

The state topic is ‘enviro/enviro-u01’, where the 2nd bit of this is the name I provided when configuring.

Thank you to previous posters in this thread - this has helped me!

Just in case it helps others, here’s my mqtt.yaml, for the pimoroni enviro urban.

sensor:
# Temperature
  - name: "Indoor Temperature (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.temperature }}"
    unit_of_measurement: "°C"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.temp"
# Humidity
  - name: "Indoor Humidity (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.humidity }}"
    unit_of_measurement: "%"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.humidity"
# Pressure
  - name: "Indoor Pressure (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pressure }}"
    unit_of_measurement: "mbar"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.pressure"
# Voltage
  - name: "Operational voltage (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.voltage }}"
    unit_of_measurement: "V"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.voltage"
# Noise
  - name: "Noise (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.noise }}"
    unit_of_measurement: "db"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.noise"
# pm1
  - name: "Particles pm1 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm1 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.pm1"
# pm2_5
  - name: "Particles pm2.5 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm2_5 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.pm2_5"
# pm10
  - name: "Particles pm10 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm10 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    unique_id: "sensor.enviro_u01.pm10"

The actual ID seems to be taken from the ‘name’, so you might want to put the u01 (=environ urban 01) or something similar at the start of the name.

Potentially the device_class should be included (see Sensor - Home Assistant). So I’m guessing that an improved template would be this:

sensor:
# Temperature
  - name: "Indoor Temperature (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.temperature }}"
    unit_of_measurement: "°C"
    state_class: "measurement"
    device_class: "temperature"
    unique_id: "sensor.enviro_u01.temp"
# Humidity
  - name: "Indoor Humidity (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.humidity }}"
    unit_of_measurement: "%"
    state_class: "measurement"
    device_class: "humidity"
    unique_id: "sensor.enviro_u01.humidity"
# Pressure
  - name: "Indoor Pressure (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pressure }}"
    unit_of_measurement: "mbar"
    state_class: "measurement"
    device_class: "pressure"
    unique_id: "sensor.enviro_u01.pressure"
# Voltage
  - name: "Operational voltage (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.voltage }}"
    unit_of_measurement: "V"
    state_class: "measurement"
    device_class: "voltage"
    unique_id: "sensor.enviro_u01.voltage"
# Noise
  - name: "Noise (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.noise }}"
    unit_of_measurement: "dB"
    state_class: "measurement"
    device_class: "sound_pressure"
    unique_id: "sensor.enviro_u01.noise"
# pm1
  - name: "Particles pm1 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm1 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    device_class: "pm1"
    unique_id: "sensor.enviro_u01.pm1"
# pm2_5
  - name: "Particles pm2.5 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm2_5 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    device_class: "pm25"
    unique_id: "sensor.enviro_u01.pm2_5"
# pm10
  - name: "Particles pm10 (u01)"
    state_topic: "enviro/enviro-u01"
    value_template: "{{ value_json.readings.pm10 }}"
    unit_of_measurement: "µg/m³"
    state_class: "measurement"
    device_class: "pm10"
    unique_id: "sensor.enviro_u01.pm10"

By the way the voltage doesn’t read anything with the current version of the firmware on the sensor. This is prob connected to the fact that there were some issues reported that led to instabilities on the sensor side.

Also see here Sensor transmits multiple time points: How to ingest into HA? regarding timing of measurements.

1 Like

Thank you, been searching/trying to figure this out for days. I was going the node-red route but this is so much better, thank you again

Thank you everyone for the work done. I have an Enviro grow and tried to setup the sensors as described here. I cannot see any devices or entities on the MQTT integration.Is driving me mad.
I can see the messages from the enviro board on the broker ( when I have listen to a topic enabled) and I can see the board connecting on the broker logs.
I have installed,unistalled and reinstalled a few times. The broker is setup with the same username and password as I entered on the Pimoroni board.
I have n o idea what I am missing. Might be something related to the newest versions oh HA and Mosquitto ?

Could you share your yaml?
I’ve bought one and would love to try it. Maybe we can figure out how to solve it together?

I am trying to get Enviro Indoor and Urban all linked up to Home Asssitant and what was here was helpful to get the devices recognised as such. But I’ve spent ages trying to solve the batch upload all being treated as data points at the same time. I’ve managed to get myself extremely confused changing different parts. Any help greatly appreciated.

image

My configuration.yaml:

mqtt:
  sensor:
    - name: "Indoor Temperature"
      state_topic: "enviro/enviro-living"
      qos: 1
      json_attributes_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.temperature }}"
      unit_of_measurement: "°C"
      state_class: "measurement"
      device_class: "temperature"
      unique_id: "sensor.enviro-living.temp"
      device:
        identifiers: ["enviro_living"]
        model: "Enviro Living"
        name: "Enviro-Living"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Humidity"
      state_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.humidity }}"
      unit_of_measurement: "%"
      state_class: "measurement"
      device_class: "humidity"
      unique_id: "sensor.enviro-living.humidity"
      device:
        identifiers: ["enviro_living"]
        model: "Enviro Living"
        name: "Enviro-Living"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Pressure"
      state_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.pressure }}"
      unit_of_measurement: "mbar"
      state_class: "measurement"
      device_class: "atmospheric_pressure"
      unique_id: "sensor.enviro-living.pressure"
      device:
        identifiers: ["enviro_living"]
        model: "Enviro Living"
        name: "Enviro-Living"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Luminance"
      state_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.luminance }}"
      unit_of_measurement: "lx"
      state_class: "measurement"
      device_class: "illuminance"
      unique_id: "sensor.enviro-living.luminance"
      device:
        identifiers: ["enviro_living"]
        model: "Enviro Living"
        name: "Enviro-Living"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Color Temperature"
      state_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.color_temperature }}"
      unit_of_measurement: "K"
      state_class: "measurement"
      device_class: "temperature"
      unique_id: "sensor.enviro-living.color_temperature"
      device:
       identifiers: ["enviro_living"]
       model: "Enviro Living"
       name: "Enviro-Living"
       manufacturer: "Pimoroni"
      
    - name: "Gas Resistance"
      state_topic: "enviro/enviro-living"
      value_template: "{{ value_json.readings.gas_resistance }}"
      state_class: "measurement"
      unique_id: "sensor.enviro-living.gas_resistance"
      device:
        identifiers: ["enviro_living"]
        model: "Enviro Living"
        name: "Enviro-Living"
        manufacturer: "Pimoroni"
      
    - name: "Outdoor Temperature"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.temperature }}"
      unit_of_measurement: "°C"
      state_class: "measurement"
      device_class: "temperature"
      unique_id: "sensor.enviro-frontyard.temp"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"
      
    - name: "Outdoor Pressure"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.pressure }}"
      unit_of_measurement: "mbar"
      state_class: "measurement"
      device_class: "atmospheric_pressure"
      unique_id: "sensor.enviro-frontyard.pressure"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"
      
    - name: "Outdoor Noise"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.noise }}"
      unit_of_measurement: "dB"
      state_class: "measurement"
      device_class: "sound_pressure"
      unique_id: "sensor.enviro-frontyard.noise"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"

    - name: "Particles pm1"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.pm1 }}"
      unit_of_measurement: "µg/m³"
      state_class: "measurement"
      device_class: "pm1"
      unique_id: "sensor.enviro-frontyard.pm1"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"

    - name: "Particles pm25"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.pm2_5 }}"
      unit_of_measurement: "µg/m³"
      state_class: "measurement"
      device_class: "pm25"
      unique_id: "sensor.enviro-frontyard.pm2_5"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"

    - name: "Particles pm10"
      state_topic: "enviro/enviro-frontyard"
      value_template: "{{ value_json.readings.pm10 }}"
      unit_of_measurement: "µg/m³"
      state_class: "measurement"
      device_class: "pm10"
      unique_id: "sensor.enviro-frontyard.pm10"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"
      
    - name: "Enviro Urban Humidity"
      state_topic: "enviro/enviro-frontyard"  # Changed from enviro/humidity
      value_template: "{{ value_json.readings.humidity }}"
      state_class: "measurement"
      unit_of_measurement: "%"
      device_class: "humidity"
      unique_id: "sensor.enviro-frontyard.humidity"
      device:
       identifiers: ["enviro_urban"]
       model: "Enviro Urban"
       name: "Enviro-urban"
       manufacturer: "Pimoroni"

    - name: "Indoor Temperature"
      state_topic: "enviro/enviro-indoor2"
      qos: 1
      json_attributes_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.temperature }}"
      unit_of_measurement: "°C"
      state_class: "measurement"
      device_class: "temperature"
      unique_id: "sensor.enviro-indoor2.temp"
      device:
        identifiers: ["enviro_indoor"]
        model: "Enviro indoor"
        name: "enviro-indoor2"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Humidity"
      state_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.humidity }}"
      unit_of_measurement: "%"
      state_class: "measurement"
      device_class: "humidity"
      unique_id: "sensor.enviro-indoor2.humidity"
      device:
        identifiers: ["enviro_indoor"]
        model: "Enviro indoor"
        name: "enviro-indoor2"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Pressure"
      state_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.pressure }}"
      unit_of_measurement: "mbar"
      state_class: "measurement"
      device_class: "atmospheric_pressure"
      unique_id: "sensor.enviro-indoor2.pressure"
      device:
        identifiers: ["enviro_indoor"]
        model: "Enviro indoor"
        name: "enviro-indoor2"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Luminance"
      state_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.luminance }}"
      unit_of_measurement: "lx"
      state_class: "measurement"
      device_class: "illuminance"
      unique_id: "sensor.enviro-indoor2.luminance"
      device:
        identifiers: ["enviro_indoor"]
        model: "Enviro indoor"
        name: "enviro-indoor2"
        manufacturer: "Pimoroni"
      
    - name: "Indoor Color Temperature"
      state_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.color_temperature }}"
      unit_of_measurement: "K"
      state_class: "measurement"
      device_class: "temperature"
      unique_id: "sensor.enviro-indoor2.color_temperature"
      device:
       identifiers: ["enviro_indoor"]
       model: "Enviro indoor"
       name: "enviro-indoor2"
       manufacturer: "Pimoroni"
      
    - name: "Gas Resistance"
      state_topic: "enviro/enviro-indoor2"
      value_template: "{{ value_json.readings.gas_resistance }}"
      state_class: "measurement"
      unique_id: "sensor.enviro-indoor2.gas_resistance"
      device:
        identifiers: ["enviro_indoor"]
        model: "Enviro indoor"
        name: "enviro-indoor2"
        manufacturer: "Pimoroni"