Tender
November 16, 2022, 5:02pm
1
Hi,
i went through several examples / topics now but still can’t figure out what’s wrong when trying to set an existing number / integration entity with the set_value service from a custom sensor value:
alias: _Debug
description: ""
trigger: []
condition: []
action:
- device_id: 28eeb3650fa6582be99d9b14a3c55296
domain: number
entity_id: number.shellytrv_60a423dcc9f8_valve_position
type: set_value
value: "{{states('sensor.valve_gaestebad')|float}}"
mode: single
Any idea someone? Thanks in advance
regards,
Tender
pedolsky
(Pedolsky)
November 16, 2022, 5:48pm
2
Welcome, Tender!
I’d use a service action, or isn’t this possible with Shellys?
Also debugging is nearly possible because the code you posted isn’t formatted properly, see here (No. 11): https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16
Tender
November 17, 2022, 7:32am
3
Sry, Code formatted now. As the Valve position is defined by the integration as number (and changable via slider), why can’t i set with other than a static value like eg. “20”?
1 Like
pedolsky
(Pedolsky)
November 17, 2022, 8:20am
4
As said before, try it with a service action.
Tender
November 17, 2022, 3:07pm
6
Bit tricky but works now:
alias: Steuerung Ventil - Gästebad
description: ""
trigger:
- platform: time_pattern
minutes: /1
condition:
- condition: or
conditions:
- condition: numeric_state
entity_id: number.shellytrv_60a423dcc9f8_valve_position
below: 0
value_template: >-
{{states('sensor.valve_gaestebad')|float -
states('number.shellytrv_60a423dcc9f8_valve_position')|float}}
- condition: numeric_state
entity_id: number.shellytrv_60a423dcc9f8_valve_position
above: 0
value_template: >-
{{states('sensor.valve_gaestebad')|float -
states('number.shellytrv_60a423dcc9f8_valve_position')|float}}
action:
- service: number.set_value
data:
value: "{{states('sensor.valve_gaestebad')|float}}"
target:
entity_id: number.shellytrv_60a423dcc9f8_valve_position
mode: single
Thanks & regards,
Tender
123
(Taras)
November 17, 2022, 4:57pm
7
alias: Steuerung Ventil - Gästebad
description: ""
trigger:
- platform: state
entity_id: sensor.valve_gaestebad
not_to: 'unavailable'
condition:
- condition: template
value_template: >
{{ trigger.to_state.state | float(0) -
states('number.shellytrv_60a423dcc9f8_valve_position') | float(0) != 0 }}
action:
- service: number.set_value
data:
value: "{{ trigger.to_state.state }}"
target:
entity_id: number.shellytrv_60a423dcc9f8_valve_position
mode: single