-
-
Notifications
You must be signed in to change notification settings - Fork 0
иногда значания недоступны #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
добавил wait_template посмотрю как будет работать sequence:
- alias: electricity day
sequence:
- wait_template: "{{ has_value('sensor.pesc_electricity_day') }}"
- if:
- condition: template
value_template: >-
{{ states('input_text.electricity_day')|int >=
(states('sensor.pesc_electricity_day')|int -1) and
states('input_text.electricity_day')|int <=
(states('sensor.pesc_electricity_day')|int +200) }}
then:
- service: pesc.update_value
target:
entity_id: sensor.pesc_electricity_day
data:
value: "{{ states( 'input_text.electricity_day' ) | int }}"
- alias: electricity night
sequence:
- wait_template: "{{ has_value('sensor.pesc_electricity_night') }}"
- if:
- condition: template
value_template: >-
{{ states('input_text.electricity_night')|int >=
(states('sensor.pesc_electricity_night')|int -1) and
states('input_text.electricity_night')|int <=
(states('sensor.pesc_electricity_night')|int +100) }}
then:
- service: pesc.update_value
target:
entity_id: sensor.pesc_electricity_night
data:
value: "{{ states( 'input_text.electricity_night' ) | int }}"
- alias: water cold
sequence:
- wait_template: "{{ has_value('sensor.pesc_water_cold') }}"
- if:
- condition: template
value_template: >-
{{ states('input_text.water_cold')|int >=
(states('sensor.pesc_water_cold')|int -1) and
states('input_text.water_cold')|int <=
(states('sensor.pesc_water_cold')|int +5) }}
then:
- service: pesc.update_value
target:
entity_id: sensor.pesc_water_cold
data:
value: "{{ states( 'input_text.water_cold' ) | int }}"
- alias: water hot
sequence:
- wait_template: "{{ has_value('sensor.pesc_water_hot') }}"
- if:
- condition: template
value_template: >-
{{ states('input_text.water_hot')|int >=
(states('sensor.pesc_water_hot')|int -1) and
states('input_text.water_hot')|int <=
(states('sensor.pesc_water_hot')|int +5) }}
then:
- service: pesc.update_value
target:
entity_id: sensor.pesc_water_hot
data:
value: "{{ states('input_text.water_hot')|int }}" |
в мастере |
по поводу того что возможно иногда некоторые сенсоры недоступны, |
не сказал, бы, что в мастере, 7e248d7 позволяет сократить количество отправок в моём случае на одну штуку: один счётчик электроэнергии с двумя тарифами можно отправить отдной транзакцией, но остальные: два по воде, и ещё один електрический однотарифный придётся отправлять отдельно ну и то, что нужно указать и entity для подачи показания и scale_id не добавляет удобства |
я использую следующий скрипт и он иногда фэйлится:
Error: In 'template' condition: ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{ states('input_text.electricity_night')|int >= (states('sensor.pesc_electricity_night')|int -1) and states('input_text.electricity_night')|int <= (states('sensor.pesc_electricity_night')|int +100) }}' but no default was specified
первый блок отрабатывает всегда, а вот последующие иногда фэйлятся
дело точно не в
input_text.*
думаю если вставить задержку между блоками будет работать стабильнее
вобще хотелось бы все показания одной транзакцией отправлять
The text was updated successfully, but these errors were encountered: