#damn it same thing

1 messages · Page 1 of 1 (latest)

prisma sail
#

I blame you fot this.... I loaded what you had and fixed it.

nocturne abyss
#

fixed it how?

#

blame me for what?

prisma sail
#

it worked without the condition altogether.

nocturne abyss
#

wat

prisma sail
#

I also added variables, don't know if that helped...

nocturne abyss
#

condition is the main point of this blueprint...

prisma sail
#

and fixed the condition.

nocturne abyss
#

where can I see it

prisma sail
#
blueprint:
  name: Custom Motion-activated Light
  description: Turn on a light when motion is detected.
  domain: automation
#  source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
          multiple: false
    light_target:
      name: Light
      selector:
        entity:
          domain: light
          multiple: true
    no_motion_wait:
      name: Wait time
      description: Time to leave the light on after last motion is detected.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    input_bool:
      name: Input boolean
      description: Input boolean to read from
      selector:
        entity:
          domain: input_boolean
          multiple: false
    input_state:
      name: Input state
      description: Input Bool state 
      default: on
      selector:
        boolean:

variables:
  no_motion_wait: !input no_motion_wait
  input_state_var: !input input_state

# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input motion_entity
  from: "off"
  to: "on"

condition:
  condition: state
  entity_id:
    - !input input_bool
  state: '{{ input_state_var }}'

# condition:
#   - condition: state
#     entity_id: !input input_bool
#     state: '{{ input_state_var }}'

action:
  - alias: "Turn on the light"
    service: light.turn_on
    target: !input light_target
  - alias: "Wait until there is no motion from device"
    wait_for_trigger:
      platform: state
      entity_id: !input motion_entity
      from: "on"
      to: "off"
  - alias: "Wait the number of seconds that has been set"
    delay: '{{ no_motion_wait_var }}'
  - alias: "Turn off the light"
    service: light.turn_off
    target: !input light_target```
#

(line limits don't count in threads....) and I hate external links to code.

nocturne abyss
#

instead of working around the error with variables, i'd rather know the cause

prisma sail
#

that renders, didn't really test it.

nocturne abyss
#

no errors in logs?

prisma sail
#

nope

#

I think the formatting of the condition fixed it

#

try that without the variables.

nocturne abyss
#
condition:
  - condition: state
    entity_id: !input input_bool
    state: "on"
#

but this is the regular format

prisma sail
#

I added the variables and that didn't fix it, I changed the syntax of the condition to match the HA docs and it rendered.

prisma sail
nocturne abyss
nocturne abyss
#

so

condition:
  condition: state
  entity_id: !input input_bool
  state: "on"

instead of

condition:
  - condition: state
    entity_id: !input input_bool
    state: "on"

fixed it lol