frenck / spook

A scary 👻 powerful toolbox 🧰 for Home Assistant 🏡
https://spook.boo
MIT License
530 stars 42 forks source link

Valid action in script is reported as unknown for an automation which uses that script #858

Closed Vitani closed 5 days ago

Vitani commented 5 days ago

What version of Spook are you using?

3.1.0

What version of Home Assistant are you using?

2024.11.1 (it was also present in 2024.10.x)

The problem

I get this error:

The automation "🔥 Turn on Kettle" (automation.claire_near_home) has an unknown action: water_heater.set_temperature.

I see two issues with this spook:

  1. The action water_heater.set_temperature shouldn't be unknown, it is a valid action
  2. This automation doesn't use the water_heater.set_temperature action, however it does call a script which contains this action.

Automation YAML (automation.claire_near_home):

alias: 🔥 Turn on Kettle
description: ""
mode: single
triggers:
  - entity_id: person.claire
    zone: zone.near_home
    event: enter
    id: near_home
    trigger: zone
  - type: opened
    device_id: 577747254dfd42d9a9e9ce289f6e36dd
    entity_id: binary_sensor.master_bedroom_door_contact
    domain: binary_sensor
    id: first_coffee
    trigger: device
  - entity_id:
      - sensor.claire_s_s24_ultra_charger_type
    id: first_coffee
    to: none
    trigger: state
conditions:
  - condition: or
    conditions:
      - condition: and
        conditions:
          - condition: trigger
            id: near_home
          - condition: time
            after: "07:30:00"
            before: "19:00:00"
      - condition: and
        conditions:
          - condition: trigger
            id: first_coffee
          - condition: time
            before: "09:00:00"
            after: "07:00:00"
          - type: is_open
            condition: device
            device_id: 577747254dfd42d9a9e9ce289f6e36dd
            entity_id: binary_sensor.master_bedroom_door_contact
            domain: binary_sensor
          - condition: zone
            entity_id: person.claire
            zone: zone.home
          - condition: state
            entity_id: switch.kitchen_kettle
            state: "off"
            for:
              hours: 2
              minutes: 0
              seconds: 0
          - condition: state
            entity_id: sensor.claire_s_s24_ultra_charger_type
            state: none
actions:
  - data: {}
    action: script.turn_kettle_on

Script YAML (script.turn_kettle_on)

alias: Kettle On
sequence:
  - alias: Set Temp based on time of day
    if:
      - condition: time
        after: "00:00:00"
        before: "12:00:00"
    then:
      - metadata: {}
        data:
          temperature: 90
        target:
          entity_id: water_heater.kitchen_kettle
        action: water_heater.set_temperature
      - metadata: {}
        data: {}
        target:
          entity_id: switch.kitchen_kettle_keep_warm
        action: switch.turn_on
    else:
      - metadata: {}
        data:
          temperature: 100
        target:
          entity_id: water_heater.kitchen_kettle
        action: water_heater.set_temperature
  - metadata: {}
    data: {}
    target:
      entity_id: switch.kitchen_kettle
    action: switch.turn_on
mode: restart
icon: mdi:kettle-steam

Anything in the logs? Paste it here!

No response

frenck commented 5 days ago

The action water_heater.set_temperature shouldn't be unknown, it is a valid action

Unfortunately, it seems like the water heater integration isn't loaded, otherwise it would have been a valid action. The reason it raises, is because it is referenced, but not available on your system. Just because the action is documented, doesn't mean it is available on your instance.

This automation doesn't use the water_heater.set_temperature action, however it does call a script which contains this action.

If it isn't used... remove it? 🤷

Closing this issue, as it sounds like it works as intended.

../Frenck

Vitani commented 4 days ago

The kettle does use that integration though? So it should be loaded?

image

What I mean by it doesn't use the water_heater.set_temperature action, it's not directly referenced in the automation configuration.

Vitani commented 3 days ago

The action also shows up in the Developer Tools

image

YAML view

image