-
Notifications
You must be signed in to change notification settings - Fork 16
Home Assistant Operating System
Adam edited this page Feb 22, 2024
·
2 revisions
sudo mkdir /config/custom_components
sudo mkdir /config/custom_components/ca350
Copy config and script from GIT https://github.com/adorobis/hacomfoairmqtt/ to /config/custom_components/ca350 /config/custom_components/ca350/ca350.py /config/custom_components/ca350/config.ini Edit config.ini as needed
python3 -m venv /config/custom_components/ca350/python3venv
source /config/custom_components/ca350/python3venv/bin/activate
pip3 install paho-mqtt==1.6.1
pip3 install pyserial
deactivate
import os
import time
pid = os.fork()
if pid > 0 :
print("I am parent process:")
print("Process ID:", os.getpid())
print("Child's process ID:", pid)
else :
print("\nI am child process:")
print("Process ID:", os.getpid())
print("Parent's process ID:", os.getppid())
while True:
print("Run ca350.py")
os.system('source /config/custom_components/ca350/python3venv/bin/activate && python3 /config/custom_components/ca350/ca350.py')
time.sleep(15)
shell_command:
start_ca350: python3 /config/custom_components/ca350/ca350runner.py &
alias: Start Pyton3 Shell Command ca350 on HA Start
description: ""
trigger:
- platform: homeassistant
event: start
condition: []
action:
- delay:
hours: 0
minutes: 2
seconds: 0
milliseconds: 0
- service: shell_command.start_ca350
data: {}
mode: single