#calling script from script causes error

46 messages · Page 1 of 1 (latest)

winged gull
#

if I call a script to set the temperature of a water kettle (effectivly a thermostat) from another script, i get a strange error (attached). Error running action Provided temperature 90.55555555555556 is not valid. Accepted range is 7 to 35 If I run the kettle script directly it works fine.

kettle script:

sequence:
  - metadata: {}
    data: {}
    target:
      entity_id: climate.kettle
    action: climate.toggle
  - metadata: {}
    data:
      temperature: 195
    target:
      entity_id: climate.kettle
    action: climate.set_temperature
description: ""
icon: mdi:kettle

good morning script:

sequence:
  - parallel:
      - alias: lights and Open covers in parallel
        parallel:
          - if:
              - condition: state
                entity_id: sun.sun
                state: above_horizon
            then:
              - data: {}
                target:
                  entity_id: cover.bedroom_shades
                action: cover.open_cover
            alias: Open Bedroom Curtains if sun is up
          - metadata: {}
            data: {}
            action: script.covers_open_all_blinds
          - metadata: {}
            data: {}
            action: script.normal_lights
          - data:
              brightness: 170
              transition: 600
            target:
              device_id:
                - b32593577db93a8379d06de33d958185
                - 40c84506044f11ebb7807b58d20e7a8a
              entity_id: scene.bedroom_dimmed
            action: hue.activate_scene
          - data:
              transition: 63
            target:
              entity_id: light.elements_35f6
            action: light.turn_on
          - metadata: {}
            data: {}
            action: script.kettle_turn_on_to_195f
          - alias: Winter / Summer options
            choose:
              - conditions:
                  - condition: state
                    entity_id: input_boolean.winter_summer
                    state: "on"
                sequence:
                  - metadata: {}
                    data:
                      temperature: 75
                    target:
                      entity_id: climate.garage_thermostat
                    action: climate.set_temperature
                alias: "Winter "
              - conditions:
                  - condition: state
                    entity_id: input_boolean.winter_summer
                    state: "off"
                sequence:
                  - if:
                      - condition: template
                        value_template: >-
                          {{ state_attr('climate.first_floor',
                          'current_temperature') | float < 60 }}
                    then:
                      - data:
                          temperature: 72
                        target:
                          entity_id: climate.fireplace
                        action: climate.set_temperature
                    alias: Turn on fireplace if open space is below 60
                alias: Summer
      - sequence:
          - metadata: {}
            data: {}
            action: script.tts_test
          - metadata: {}
            data: {}
            action: script.tts_calendar_briefing
        alias: TTS Briefings in sequence
mode: restart
icon: mdi:weather-sunset-up
description: replaced with summer version in July 2024 - need to update for winter
vale star
#

that toggles on -> off -> on -> etc every time you call it

brittle nexus
#

And what do the attributes of the entity climate.kettle say in the dev tools?

#

Especially the attributes min_tempand max_temp

vale star
#

I'm assuming that the toggle is putting it in an unwanted state and the min/max is adjusting

rigid schooner
#

the 90.55555555555555~ matches with 195 fahrenheit. Which seems a tad high for a thermostat

brittle nexus
#

It is a kettle

rigid schooner
#

ah, 7 to 35 degrees Celsius seems to be a reasonable range for a thermostat though. So that's probably where the error message is based on

vale star
#

Well, the script works from just calling it

#

so the only reason it wouldn't work is the toggle

#

right, imagine running the first time and it works, then testing the automation

rigid schooner
#

I can imagine it throws that error if it's already on

vale star
#

it would... on -> off, then error

rigid schooner
#

basically you're turning it off together with setting a temperature

winged gull
brittle nexus
vale star
#

assuming there is a turn on service

rigid schooner
#

I need more coffee, it's two seperate service calls actions

#

vale star
#

only if you had a kettle to turn on

#

with your house

winged gull
#

ok this is really odd... because this all worked before the 2024.09

min_temp: 45
max_temp: 95
current_temperature: 32
temperature: null
hvac_action: idle
friendly_name: Kettle
supported_features: 385```

The max temp is actuall 212f / 100c so I'm not sure where 95 came from
rigid schooner
#

Yes, 90.555555~ degrees Celsius seems like a fine temperature for coffee

winged gull
#

I just set it to 195f / 90c so it doesnt boil over

#

I live at altitude, water boils at 93c

rigid schooner
#

check if you can use climate.turn_on in devtools > actions on the entity

#

if that works, use that in your script

winged gull
#

i know for a fact that max_temp was not 95 before 2024.09

rigid schooner
#

if the kettle is already on now, your toggle service call will turn it off first, and then you will get the error because it's off

winged gull
#

climate turn on works

rigid schooner
#

The error doesn't explain the actual issue very well though

winged gull
vale star
#

I'd wager when the climate is off the attributes are gone and then the service bitches if it's not between the default ranges

rigid schooner
#
alias: "Kettle - turn on to 195F "
sequence:
  - target:
      entity_id: climate.kettle
    action: climate.turn_on
  - data:
      temperature: 195
    target:
      entity_id: climate.kettle
    action: climate.set_temperature
description: ""
icon: mdi:kettle
rigid schooner
#

so use that

winged gull
#

I think the iOS shortcut is failing and it calls the script more than once... which would have toggled from of to on to off ... that makes sense now that I think about it

rigid schooner
vale star
winged gull
#

in testing moving from toggle to turn on seems to fix the issue

vale star
#

whatever is creating that is doing some fuckery

winged gull
# vale star it's very odd that your kettle is a climate device

yeah, I need to create a tempalte and replace it... it's some serious fuckery. The kettle has bluetooth with a strange protocol that someone integrated into Homebridge. I happen to have a Pi in the same room, so I installed homebridge just for the kettle and then I pull it into HA via a homekit device. Seriousy fuckery

#

but homebridge exposes it as a climate device and it works (mostly) so I haven't bothered yet ¯_(ツ)_/¯