Smart Life door sensor as binary sensor throws errors

Hey,
I am setting up my first HA and experiment with my Smart Life door sensor:

configuration.yml:

binary_sensor:
  - platform: ping
    host: 192.168.178.39
    count: 1
    scan_interval: 1
    name: ping_tuya_contact_door_sensor

automations.yaml:

- alias: "Door sensor"
  trigger:
  - entity_id: binary_sensor.ping_tuya_contact_door_sensor
    platform: state
    to: 'on'
#   condition:
#     condition: time
#     after: '19:00'
#     before: '08:00'
  action:
    services:
    - service: notify.mobile_app_x
    - service: notify.notify
    - service: logbook.log
      data: 
        message: "door opened"

In general this seem to work but I have the log full with these messages as the device is only available in the network during state change:

Updating ping binary_sensor took longer than the scheduled update interval 0:00:01

How can I setup the device to log nothing if it is not available?

Thanks!

in configuration.yaml, under logger:

logger:
  default: error
  logs:
    homeassistant.components.ping: critical

but isn’t that just symptomatic treatment?

I would like to have sth like that:

  • check if device is available
  • if the device is available:
    ** check state
  • if not
    ** do nothing

Ping is a method to see if something is available. It does not check state.

thx, it works as expected!

i’m new to home assistant, what integration did you use for this ? Where did you add the yaml ?
thanks,

a ping binary sensor goes into configuration.yaml under binary_sensor: , or if you did split up your configuration in binary_sensor.yaml (or whatever you called it)

Cool. Yeah just wondering where i could fine that file, i think i found it using file editor. Seems it’s still pretty empty though. Is that ok?

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yam
l```

If you just started with HA, yes. It will fill up as you add integrations.

Many Thanks. I thought i had to add this integration via the frontend, i guess there’s 2 ways of adding them.

It is only a small amount of integrations that can be installed in the frontend at the moment, but every new release there are some more.

1 Like

So i just put this code in the configuration.yaml. Works great, state goes from Off to On. And looking at my door sensor, i realise that when i open a door, it drops off the network after 3s or so. So it goes Off again :wink:

And i want to measure if a door is open too long…not sure now how to go about that.

Any tips most welcome.

hey Jan, does your sensor not switch from off to on (for 3seconds or so) and then back to off again ? I use the exact same yaml code, but regardless if the door is closed or open, it will exhibit the above behaviour.

Which makes it really hard to determine if it’s open or not…

Yeah that is an issue I experienced as well. It is not about the status of the sensor in general but if the sensor is available in general what he is during sending updates. So use that information wise.
Have not found another way to integrate a Smart Life door sensor so far.

1 Like