Openhab and motioneye

Hello, I integrated motioneye to openhab, In sitemap i can turn on or off motion detection, but how can I get state of detection? because I restart motioneye and state became ACTIVE, but in my sitemap its OFF.
my item
Switch VT_Camera_Armed “Camera Armed” { http=">[ON:GET:http://192.168.88.240:7999/1/detection/start] >[OFF:GET:http://192.168.88.240:7999/1/detection/pause]" }

my sitemap
Switch item=VT_Camera_Armed icon=“camera” label=“Детектор движения камеры”

solved
rule

rule “Детектор движения OFF” when
Item check_motion changed
to PAUSE then
VT_Camera_Armed.sendCommand(OFF)
end

new item

String check_motion “Статус детектора” {channel=“exec:command:apc:output”}

new thing

Thing exec:command:apc [command=“python3 /home/orange/scripts/check_motion.py”, interval=15, timeout=5,autorun=true,transform=“REGEX((.*?))”]

script

import requests
url="http://192.168.88.240:7999/1/detection/status"
req=requests.get(url)
req=req.text
if req.find('PAUSE') != -1:
    print('PAUSE')
else:
    print('ACTIVE')

maybe you have better solution) give me it

1 Like