cgarwood / homeassistant-fullykiosk

Fully Kiosk Browser integration for Home Assistant
Apache License 2.0
153 stars 27 forks source link

Add support for motion detection #3

Open cgarwood opened 4 years ago

cgarwood commented 4 years ago

Fully has a built-in motion detection system using the device camera. However, there's not a REST endpoint (and polling wouldn't work anyway for motion detection).

Newer versions of Fully have an MQTT client, and publish motion events to MQTT. We'd need to add in MQTT support to listen for these events.

SamMousa commented 3 years ago

Workaround: if FKB is configured to turn on the screen on motion you could use that to detect motion / presence.

Senbei123 commented 3 years ago

Workaround: if FKB is configured to turn on the screen on motion you could use that to detect motion / presence.

But there is currently no sensor to detect if the screen is on or off? The light.*_screen entity doesn't response accurate if the screen is on or off..

/update My fault, Home Assistant just doesn't update the sensor so fast.. need to figure out how to create an own sensor for this...

bcutter commented 3 years ago

Workaround: if FKB is configured to turn on the screen on motion you could use that to detect motion / presence.

But there is currently no sensor to detect if the screen is on or off? The light.*_screen entity doesn't response accurate if the screen is on or off..

/update My fault, Home Assistant just doesn't update the sensor so fast.. need to figure out how to create an own sensor for this...

Did you meanwhile?

SamMousa commented 3 years ago

Actually OP is correct. MQTT is needed for the live updates

zetlen commented 2 years ago

I've got separate motion, sound, and device vibration detectors going with some manual MQTT entities. Seems like this could be a part of the integration pretty easily. If Fully only exposes the right events and data over MQTT, then the integration can implement it internally as an MQTT sensor, am I right?

First, I changed the topics in the Fully config to be less noisy: Device info topic: $appId/$deviceId Events topic base: $appId/$deviceId/event

Then, these go in your configuration.yaml or some include thereto:

binary_sensor:
  - platform: mqtt
    name: "Fully Kiosk Motion Sensor"
    unique_id: "fully_kiosk_{YOUR_DEVICE_ID}_motion"
    availability_topic: "fully/{YOUR_DEVICE_ID}"
    availability_template: |-
      {{ 'online' if value_json.motionDetectorStatus > 0 else 'offline' }}
    device_class: motion
    off_delay: 60
    state_topic: "fully/{YOUR_DEVICE_ID}/event/onMotion"
    value_template: |-
      {{ 'ON' if value_json.type == 'visual' and value_json.event == 'onMotion' }}
  - platform: mqtt
    name: "Fully Kiosk Sound Sensor"
    unique_id: "fully_kiosk_{YOUR_DEVICE_ID}_sound"
    availability_topic: "fully/{YOUR_DEVICE_ID}"
    availability_template: |-
      {{ 'online' if value_json.motionDetectorStatus == 2 else 'offline' }}
    device_class: sound
    off_delay: 60
    state_topic: "fully/{YOUR_DEVICE_ID}/event/onMotion"
    value_template: |-
      {{ 'ON' if value_json.type == 'acoustic' and value_json.event == 'onMotion' }}
  - platform: mqtt
    name: "Fully Kiosk Movement Sensor"
    unique_id: "fully_kiosk_{YOUR_DEVICE_ID}_movement"
    availability_topic: "fully/{YOUR_DEVICE_ID}"
    availability_template: |-
      {{ 'online' if value_json.mqttConnected else 'offline' }}
    device_class: moving
    off_delay: 60
    state_topic: "fully/{YOUR_DEVICE_ID}/event/onMovement"
    value_template: |-
      {{ 'ON' if value_json.event == 'onMovement' }}
comedido commented 1 year ago

Very interested in this feature. I currently use the screen sensor (turn on screen on motion detection) to trigger light switch automation in my kitchen. However I find it laggy and slow. If only the motion sensor would be exposed, maybe response times would be better