Air quality sensor PM1006 dynamic update interval

Hi,

I am working on a multisensor that uses the Ikea Vindriktning IKEA Vindriktning Smart Home Multisensor Mod by Knuspel - Thingiverse which measures PM2.5 with a PM1006. I want to change the update interval so that it measures more frequently at daytime than at night (or similar).

My plan is to set its update interval to never, like so:

- platform: pm1006
    id: multisensorPm1006
    update_interval: never
    pm_2_5:
      name: "Multisensor PM2.5 PM1006"
      id: multisensorPm25Pm1006

and then call an update at a specified interval, like so:

interval:
  - interval: 20s
    then:
      - component.update: multisensorBmp180
      - component.update: multisensorPm1006

While it works for the Bmp180, I get an error for the PM1006, saying it does not inherit from PollingComponent (so the update function is not implemented). The error message is

ID 'multisensorPm1006' of type pm1006::PM1006Component doesn't inherit from PollingComponent. Please double check your ID is pointing to the correct value.

Looking at the sources at EspHome confirms that PM1006Component IS a PollingComponent. Looking at the C++ code also confirms this, and the required update method is implemented.

What am I doing wrong? This issue bugs me for quite while now …

Kind regards,
Knuspel

I had the same error with DHT22 when I tried to set separate polling interval for temperature and humidity.

Looks like you can’t set the polling interval to the “sub” component of the sensor. Both seem to be polled when you use the interval of the parent sensor.

I do it this way…


script:
  - id: interval
    mode: restart
    then:
      - component.update: bme280_sensor
      - delay: !lambda "return id(update_interval).state * 1000;"
      - script.execute: interval

sensor:
  - platform: homeassistant
    id: update_interval
    entity_id: input_number.bme280_update_interval
    on_value:
      then:
        - script.execute: interval

  - platform: bme280
    id: bme280_sensor
    address: 0x76
    update_interval: never
    temperature:
      name: $device_name Temperature
      id: temperature
      icon: mdi:temperature-fahrenheit
      accuracy_decimals: 1
    humidity:
      name: $device_name Humidity
      id: humidity
      icon: mdi:water-percent
      accuracy_decimals: 1
    pressure:
      name: $device_name Pressure
      id: pressure
      accuracy_decimals: 5

1 Like

Any solution to this ?