Skip to content

Efficient Deep Sleep example #44

@florianL21

Description

@florianL21

I am currently building a sensor with this component and so far it mostly works pretty great.

But when I try to utilize the deep sleep component of esphome no attribute updates seem to be sent to the coordinator for quite a while after reset even though there are no errors visible in the logs.

It seems like it needs at least 30s after boot to even send out a single attribute update. I find this extremely inefficient.
I assume there must be a better way since it is explicitly mentioned in the readme right?

My working ESPHome config

external_components:
  - source: github://luar123/zigbee_esphome
    components: [zigbee]

esphome:
  name: zigbeetest
  friendly_name: ZigbeeTest

esp32:
  board: esp32-c6-devkitc-1
  partitions: partitions_zb.csv
  framework:
    type: esp-idf

logger:
  hardware_uart: UART0

i2c:
  sda: GPIO22
  scl: GPIO23
  id: bus_a

sensor:
  - platform: scd4x
    co2:
      name: "CO2"
      id: co2
    temperature:
      name: "Temperature"
      id: temp
    humidity:
      name: "Humidity"
      id: humid
    update_interval: 10s

deep_sleep:
  id: deep_sleep_1
  sleep_duration: 10min
  run_duration: 40s

zigbee:
  id: "zb"
  on_join:
    then:
      - logger.log: "Joined network"
  endpoints:
    - device_type: TEMPERATURE_SENSOR
      num: 1
      clusters:
        - id: REL_HUMIDITY_MEASUREMENT
          attributes:
            - attribute_id: 0
              id: hum_attr
              type: U16
              report: true
              device: humid
              scale: 100
        - id: TEMP_MEASUREMENT
          attributes:
            - attribute_id: 0x0
              id: temp_attr
              type: S16
              report: true
              device: temp
              scale: 100
        - id: CARBON_DIOXIDE_MEASUREMENT
          attributes:
            - attribute_id: 0x0
              id: co2_attr
              type: single
              report: true
              device: co2
              scale: 0.000001
            - attribute_id: 0x2
              type: single
              value: 10000

Another issue with this configuration is that the sensor expects to be polled every 10min as per manufacturer spec as it does a re-calibration routine after a prefixed number of polls and with this 10s polling interval (which is needed since I need to try a few times for the attribute updates to actually make it through, even though I see no errors in the logs of the device) the assumption about the number of polls before the sensor runs it's calibration is wrong.

So in the end what I am wondering are the following points:

  • Is there a way to reliably know if a zigbee attribute update was in fact sent out, which ultimately could be used to trigger the device to go into deep sleep?
  • Is there a way to make the startup faster so that I don't need to be wasting power for ~40s just to send a single status update?
  • Is there maybe some example configuration which could illustrate how to set this up? I assume that I am missing something here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions