Automate stream motioneye camera live feed to Kodi on motion detection

As I don´t have a supported camera for the new feature ( camera.play_stream) included on 0.90 and I have not neither a Gogle Home device, I have created the “almost” same funcionality with motionEye and Kodi as follow:

configuration.yamf:

homeassistant:
  auth_providers:
   - type: trusted_networks
     trusted_networks:
       - <motioneye ip>

automation: !include automations.yaml

camera:
  - platform: mjpeg
    mjpeg_url: http://<motioneye ip>:8081
    name: MyCamera

input_boolean:
  motion_state_camera:
    initial: off

media_player:
   - platform: kodi
     host: <kodi ip>
     name: mykodi

MotionEye notification command:

Command:
curl -X POST -H "Content-Type: application/json" -d '{"entity_id": "input_boolean.motion_state_camera"}' http://<hassio ip>:8123/api/services/input_boolean/turn_on

Comand End:
curl -X POST -H "Content-Type: application/json" -d '{"entity_id": "input_boolean.motion_state_camera"}' http://<hassio ip>:8123/api/services/input_boolean/turn_off

automations.yaml

alias: Alert Motion Detected
trigger:
- entity_id: input_boolean.motion_state_camera
  from: 'off'
  platform: state
  to: 'on'
condition: []
action:
- data:
    entity_id: media_player.mykodi
    item:
      file: http://<motioneye ip>:8081
    method: Player.Open
  service: media_player.kodi_call_method

I hope you find this info usefull …

6 Likes

Thanks for the example. How can you set the camera stream play for 30 seconds and then contine playing a movie ?

1 Like