Get sensors to send data specific times

Making my first step into the HA world I now started building my own sensors. I did some projects with raspberry pi’s and such, but I have to say that ESPhome is way easier. Checked which misc sensors I had and have now wired together a wemos d1 mini clone + SDS011 particulate sensor + SHTC3 temp/rh sensor.

So far so good, but what I want is that the sensors run at specific time and not based on when the ESP was booted. For this I guess I need to use the time component. So let’s say I want wifi strength and temp/rh each minute, I now have:

sensor:
  - platform: uptime
    name: "Uptime"

  - platform: wifi_signal
    name: "WiFi Signal dB"
    id: wifi_signal_db
    entity_category: "diagnostic"
  
  - platform: shtcx
    id: shtc3_sensor
    temperature:
      name: "Temperature"
      accuracy_decimals: 2
      id: air_temperature
    humidity:
      name: "Humidity"
      accuracy_decimals: 2
      id: relative_humidity
    address: 0x70
  
time:
  - platform: homeassistant
    on_time:
      - seconds: 0
        minutes: /1
        then:
          - component.update: wifi_signal_db
          - component.update: shtc3_sensor

My expectation is that this would run every minute, 00 on the dot. While it does exactly that, it ALSO sends out data at other times. How can I limit sending data only to HA for (in this example) 11:00:00, 11:01:00, 11:02:00, etc?

Looking forward to hear what I messed up :slight_smile:

Remco

Time	level	Tag	Message
11:00:00	[D]	[sensor:093]	
'WiFi Signal dB': Sending state -67.00000 dBm with 0 decimals of accuracy
11:00:00	[D]	[shtcx:100]	
Got temperature=21.14°C humidity=57.92%
11:00:00	[D]	[sensor:093]	
'Temperature': Sending state 21.13770 °C with 2 decimals of accuracy
11:00:00	[D]	[sensor:093]	
'Humidity': Sending state 57.91626 % with 2 decimals of accuracy
11:00:26	[D]	[shtcx:100]	
Got temperature=21.18°C humidity=58.10%
11:00:26	[D]	[sensor:093]	
'Temperature': Sending state 21.18309 °C with 2 decimals of accuracy
11:00:26	[D]	[sensor:093]	
'Humidity': Sending state 58.09784 % with 2 decimals of accuracy
11:00:39	[D]	[sensor:093]	
'WiFi Signal dB': Sending state -68.00000 dBm with 0 decimals of accuracy
11:00:46	[D]	[sensor:093]	
'Uptime': Sending state 118.93900 s with 0 decimals of accuracy
11:01:00	[D]	[sensor:093]	
'WiFi Signal dB': Sending state -68.00000 dBm with 0 decimals of accuracy
11:01:00	[D]	[shtcx:100]	
Got temperature=21.13°C humidity=58.00%
11:01:00	[D]	[sensor:093]	
'Temperature': Sending state 21.13235 °C with 2 decimals of accuracy
11:01:00	[D]	[sensor:093]	
'Humidity': Sending state 58.00476 % with 2 decimals of accuracy
11:01:26	[D]	[shtcx:100]	
Got temperature=21.14°C humidity=58.13%
11:01:26	[D]	[sensor:093]	
'Temperature': Sending state 21.13770 °C with 2 decimals of accuracy
11:01:26	[D]	[sensor:093]	
'Humidity': Sending state 58.13446 % with 2 decimals of accuracy
11:01:39	[D]	[sensor:093]	
'WiFi Signal dB': Sending state -69.00000 dBm with 0 decimals of accuracy
11:01:46	[D]	[sensor:093]	
'Uptime': Sending state 178.93800 s with 0 decimals of accuracy
11:02:00	[D]	[sensor:093]	
'WiFi Signal dB': Sending state -67.00000 dBm with 0 decimals of accuracy
11:02:00	[D]	[shtcx:100]	
Got temperature=21.15°C humidity=57.90%
11:02:00	[D]	[sensor:093]	
'Temperature': Sending state 21.14571 °C with 2 decimals of accuracy
11:02:00	[D]	[sensor:093]	
'Humidity': Sending state 57.89795 % with 2 decimals of accuracy

You could try heartbeat:, but that will update every minute from startup, so not necessarily on the exact minute:

1 Like

For every minute I can just add update_interval: 1min, but looking for a solution that outputs exactly on :00. It does already, but no idea how to get rid of the values output at :26, :39 and :46.

Add following to your SHTC3 YAML

update_interval: never

Assumptions are the mother of all… now I know most default to 60s, thank you for the pointer! Added it to the yaml and now it’s more or less on the dot. still a mix between :59 and :00 though.

1 Like