Hi, i have an automation thats strats an python script at startup of HA , that scripts is somekind of socket server where i send messages too and receive messages from
so i also have an sensor configured, but at startup, the first time it failes and i get errors in my log file because of that
how can i delay that sensor with like 10 seconds or something?
here is automation + sensor yaml
#automation
- alias: Socket Server
initial_state: 'on'
trigger:
- platform: homeassistant
event: start
action:
- service: shell_command.python_server #somekind of python file here
#sensor
- platform: command_line
command: !secret dobissreceive #somekind of python_script file here
name: prog
scan_interval: 10
indeed, i dont want a delay automation, i need my sensor being delayed …
my automation is started at HA startup, but probably the sensors is being fired first
hmm; that doesnt help, its all slow now
2020-06-25 17:24:58 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform command_line is taking over 10 seconds.
offcourse, i am just sending an “ok” command to a server … that server then gives me feedback about all my lights in my house … its to create value templates for all my lights/switches …
import socket
import sys
import time
import binascii
#time.sleep(20)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 10000)
sock.connect(server_address)
try:
for x in range(0,1):
message = "sensor"
message = message.encode()
sock.sendall(message)
data = sock.recv(2048)
print(data.decode())
finally:
sock.close()