jrel
(Jan)
October 7, 2021, 12:15pm
1
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!
francisp
(Francis)
October 7, 2021, 12:19pm
2
in configuration.yaml, under logger:
logger:
default: error
logs:
homeassistant.components.ping: critical
jrel
(Jan)
October 7, 2021, 12:21pm
3
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
francisp
(Francis)
October 7, 2021, 12:23pm
4
Ping is a method to see if something is available. It does not check state.
Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.
Ping measures the round-trip time for messages sent from the originating host to a destination computer that are echoed back to the source. The name comes from active sonar terminology that sends a pulse of sound and li...
jrel
(Jan)
October 7, 2021, 12:33pm
5
thx, it works as expected!
atv
(atv)
October 7, 2021, 5:29pm
6
i’m new to home assistant, what integration did you use for this ? Where did you add the yaml ?
thanks,
francisp
(Francis)
October 7, 2021, 5:36pm
7
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)
atv
(atv)
October 7, 2021, 5:38pm
8
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```
francisp
(Francis)
October 7, 2021, 5:52pm
9
If you just started with HA, yes. It will fill up as you add integrations.
atv
(atv)
October 7, 2021, 5:52pm
10
Many Thanks. I thought i had to add this integration via the frontend, i guess there’s 2 ways of adding them.
francisp
(Francis)
October 7, 2021, 5:55pm
11
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
atv
(atv)
October 7, 2021, 6:46pm
12
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
And i want to measure if a door is open too long…not sure now how to go about that.
Any tips most welcome.
atv
(atv)
October 7, 2021, 9:02pm
13
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…
jrel
(Jan)
October 8, 2021, 8:05am
14
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