claudegel / sinope-130

Neviweb130 custom component for Home Assistant to manage devices connected via a GT130 and wifi devices from Sinopé

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to turn on the lights?

OptimAdam opened this issue · comments

Hi I am quite new to HA and wanted to know if there was away to turn on the light with automation.

I want to turn on the Sinope light when motion is detected. The automation is triggering on motion but the light is not coming on. I thought I might be able to call a service or set the attribute but reading online they say its not possible to set attributes and I cant find a service for turning on and off the light

Does anyone know if this is possible of if there is anything I am missing?

alias: Motion detection
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 6d546f733d6953362671d88a46bde0e8
    entity_id: binary_sensor.up_sense_motion_detected
    domain: binary_sensor
condition: []
action:
  - condition: state
    entity_id: light.neviweb130_light_light_hall_way
    attribute: onOff
    state: "on"
mode: single

Yes it is possible but your automation is wrong
-trigger is what will fire the automation. some state should be met or changed to fire the automation
-condition is some specific patern that must be in place for the automation to start. ex. open the light only if it is during the night
-action is what HA will do to turn on the light using the service light.turn_on
-delay in the action section is a time to wait before doing another action
See one of my automation below as an example:

###############################
##     présence solarium de nuit
###############################
  - alias: presence solarium
    initial_state: true   <- true: the automation is on when HA start, False, the automation stay off
    trigger:
      platform: state
      entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_03cc7a05_occupancy
      to: 'on'   <- when the sensor detect motion it state turn on
    condition:
      condition: and
      conditions:
        - condition: state # from sunset until sunrise  <- it is during the night
          entity_id: sun.sun
          state: "below_horizon"
        - condition: state # lumière solarium éteinte  <- the light is turned off.  If the light is on the automation won't fire
          entity_id: light.sinope_light_lumiere_solarium
          state: off
    action:
      - service: light.turn_on
        entity_id:
          - light.sinope_light_lumiere_solarium
          - light.sinope_light_lumiere_cour
      - delay:
          seconds: 240   <- wait that amount of seconds
      - service: light.turn_off
        entity_id:
          - light.sinope_light_lumiere_solarium
          - light.sinope_light_lumiere_cour

Thanks, I changed to Service: light.turn_on and works for me

alias: Motion detection
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 6d546f733d6953362671d88a46bde0e8
    entity_id: binary_sensor.up_sense_motion_detected
    domain: binary_sensor
condition: []
action:
  - service: light.turn_on
    entity_id:
      - light.neviweb130_light_light_hall_way
    data: {}
mode: single