Skip to content

Integration : Home assistant

Gaël Bréard edited this page Jan 22, 2025 · 1 revision

Add white led in home assistant

For now it requires polling to get status.


light:
  - platform: template
    lights:
      z55_light:
        unique_id: "z55_light"
        turn_on:
          - action: rest_command.z55_camera_light_on
        turn_off:
          - action: rest_command.z55_camera_light_off
        #value_template: "{{ is_state('binary_sensor.z55_light_status', 'on') }}"
        value_template: "{{ states('binary_sensor.z55_light_status') }}"
template:
  - unique_id: z55_light_status_template
    trigger:
      - trigger: time_pattern
        seconds: /30
    action:
      - action: rest_command.z55_camera_light_status
        response_variable: z55_response
    binary_sensor:
      - name: z55_light_status
        unique_id: z55_light_status
        state: >
          {{ z55_response['content']['message']['white'] == 1 }}
        
      
rest_command:
  z55_camera_light_on:
    url: "http://z55.home/x/json-imp.cgi?cmd=white&val=1"
    username: root
    password: MyRootPassword
    verify_ssl: false
    method: get

  z55_camera_light_off:
    url: "http://z55.home/x/json-imp.cgi?cmd=white&val=0"
    username: root
    password: MyRootPassword
    verify_ssl: false
    method: get

  z55_camera_light_status:
    url: "http://z55.home/x/json-imp.cgi?cmd=white&val=read"
    username: root
    password: MyRootPassword
    verify_ssl: false
    method: get
    headers:
      Accept: "*/*"



Clone this wiki locally