Hi there,
I am using a zigbee temperature sensor and a WLED device.
I created wled presets from the name 28-40, which I want to select to use from home assistant. While I choose a preset from the dropdown, or enter a number between 28 and 40, I can change the current preset of the wled device without any issue. When I try to use the temparature from the zigbee temperature sensor casting it to a integer and then to a float, I cannot change the preset.
Here are some information to it:
Step 1: Verify if I am casting the value correctly:
I created an automation to send the current temperature as string to my iPhone:
Sending the cated string of the state to my iphone
I can successfully see the message, 29 is diplayed for the query.
Step 2: Make sure my result of the state is a correct state to choose from
I verified in the developer tools\ state if my value (in this example 29) is a valid input:
Step 2 - verifying the valid state in the developer tools
29 seems to be a valid input
Step 3: Set the state manually in the automation:
If I am entering 29 or “29” in the automation it works without any problems.
This is working without a problem. So it looks like I am still messing something up with my casting of the sensor value to the string.
Exact errormessage:
“Option is not valid for entity…”
What am I doing wrong with converting the temperature to the string?
I got a step further and modified my automation:
alias: Rack - LED-Steuerung
description: ""
triggers:
- trigger: time_pattern
minutes: /5
conditions: []
actions:
- action: select.select_option
target:
entity_id: select.wled_rack_preset
data:
option: "{{(states('sensor.racktemperatur_temperature'))|int|string}}"
mode: single
It works now if I click the run button on the action, but homeassistant doesn’t allow me to save the automation:
Message malformed: extra keys not allowed @ data[‘actions’][0][‘target’][‘data’]
Got it working, here’s the full code:
alias: Rack - LED-Steuerung
description: ""
triggers:
- trigger: time_pattern
minutes: /5
conditions: []
actions:
- action: select.select_option
target:
entity_id: select.wled_rack_preset
data:
option: "{{(states('sensor.racktemperatur_temperature'))|int|string}}"
mode: single