Thanks @FloSyno
I don’t do much with Hozelock in my Home Assistant setup, but here is what it looks like:
###############################################################################
# CONFIGURATION
###############################################################################
sensor:
- platform: rest
resource: !secret hozelock_controller_0_url
name: "Hozelock Controller 0"
timeout: 60
value_template: '{{ value_json["controller"]["name"] }}'
json_attributes:
- controller
- platform: template
sensors:
hozelock_controller_0_pause_starttime:
friendly_name: "Début pause"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['pause'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["pause"]["startTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_pause_endtime:
friendly_name: "Fin pause"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['pause'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["pause"]["endTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_pause_duration:
friendly_name: "Durée pause"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['pause'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["pause"]["duration"] | int / 86400000 | int }}
{% else %}
unknown
{% endif %}
unit_of_measurement: 'j'
hozelock_controller_0_adjustment_starttime:
friendly_name: "Début ajustement"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['adjustment'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["adjustment"]["startTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_adjustment_endtime:
friendly_name: "Fin ajustement"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['adjustment'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["adjustment"]["endTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_adjustment_wateringadjustment:
friendly_name: "Quantité ajustement"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['adjustment'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["adjustment"]["wateringAdjustment"] }}
{% else %}
unknown
{% endif %}
unit_of_measurement: '%'
hozelock_controller_0_waternowevent_starttime:
friendly_name: "Arrosage manuel (début)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['waterNowEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["waterNowEvent"]["startTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_waternowevent_endtime:
friendly_name: "Arrosage manuel (fin)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['waterNowEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["waterNowEvent"]["endTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_waternowevent_duration:
friendly_name: "Arrosage manuel (durée)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['waterNowEvent'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["waterNowEvent"]["duration"] | int / 60000 | int }}
{% else %}
unknown
{% endif %}
unit_of_measurement: 'min'
hozelock_controller_0_currentwateringevent_starttime:
friendly_name: "Arrosage en cours (début)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['currentWateringEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["currentWateringEvent"]["startTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_currentwateringevent_endtime:
friendly_name: "Arrosage en cours (fin)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['currentWateringEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["currentWateringEvent"]["endTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_currentwateringevent_duration:
friendly_name: "Arrosage en cours (durée)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['currentWateringEvent'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["currentWateringEvent"]["duration"] | int / 60000 | int }}
{% else %}
unknown
{% endif %}
unit_of_measurement: 'min'
hozelock_controller_0_nextwateringevent_starttime:
friendly_name: "Prochain arrosage (début)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['nextWateringEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["nextWateringEvent"]["startTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_nextwateringevent_endtime:
friendly_name: "Prochain arrosage (fin)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['nextWateringEvent'] %}
{{ ( state_attr("sensor.hozelock_controller_0", "controller")["nextWateringEvent"]["endTime"] | int / 1000 ) | int | timestamp_local }}
{% else %}
unknown
{% endif %}
hozelock_controller_0_nextwateringevent_duration:
friendly_name: "Prochain arrosage (durée)"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['nextWateringEvent'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["nextWateringEvent"]["duration"] | int / 60000 | int }}
{% else %}
unknown
{% endif %}
unit_of_measurement: 'min'
hozelock_controller_0_lastcommunicationwithserver:
friendly_name: "Dernière communication"
value_template: '{{ ( state_attr("sensor.hozelock_controller_0", "controller")["lastCommunicationWithServer"] | int / 1000 ) | int | timestamp_local }}'
hozelock_controller_0_nextcommunicationwithserver:
friendly_name: "Prochaine communication"
value_template: '{{ ( state_attr("sensor.hozelock_controller_0", "controller")["nextCommunicationWithServer"] | int / 1000 ) | int | timestamp_local }}'
hozelock_controller_0_batterystatus:
friendly_name: "Etat batterie"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["batteryStatus"] }}'
hozelock_controller_0_signalstrength:
friendly_name: "Puissance signal"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["signalStrength"] }}'
hozelock_controller_0_overridescheduleduration:
friendly_name: "Remplacement durée prog"
value_template: >-
{% if states.sensor.hozelock_controller_0.attributes.controller['overrideScheduleDuration'] %}
{{ state_attr("sensor.hozelock_controller_0", "controller")["overrideScheduleDuration"] | int / 60000 | int }}
{% else %}
unknown
{% endif %}
unit_of_measurement: 'min'
hozelock_controller_0_schedulename:
friendly_name: "Nom programme"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["schedule"]["name"] }}'
rest_command:
# Hozelock
hozelock_waternow:
url: https://hoz3.com/restful/support/hubs/{{ hub_id }}/controllers/actions/waterNow
method: POST
payload: '{"controllerIDs":[ {{ controller_id }} ],"duration": {{ duration }} }'
content_type: 'application/json'
hozelock_stopwatering:
url: https://hoz3.com/restful/support/hubs/{{ hub_id }}/controllers/actions/stopWatering
method: POST
payload: '{"controllerIDs":[ {{ controller_id }} ]}'
content_type: 'application/json'
hozelock_pause:
url: https://hoz3.com/restful/support/hubs/{{ hub_id }}/controllers/actions/pause
method: POST
payload: '{"controllerIDs":[ {{ controller_id }} ],"duration": {{ duration }} }'
content_type: 'application/json'
hozelock_unpause:
url: https://hoz3.com/restful/support/hubs/{{ hub_id }}/controllers/actions/unpause
method: POST
payload: '{"controllerIDs":[ {{ controller_id }} ]}'
content_type: 'application/json'
input_number:
hozelock_duration:
name: Durée
min: 1
max: 60
step: 1
icon: mdi:clock-outline
unit_of_measurement: "min"
hozelock_duration_pause:
name: Durée
min: 1
max: 14
step: 1
icon: mdi:clock-outline
unit_of_measurement: "j"
binary_sensor:
- platform: template
sensors:
hozelock_controller_0_haswaternowevent:
friendly_name: "Water now event"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["hasWaterNowEvent"] }}'
hozelock_controller_0_ischildlockenabled:
friendly_name: "Verrou enfant"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isChildlockEnabled"] }}'
hozelock_controller_0_iswatering:
friendly_name: "Arrosage en cours"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isWatering"] }}'
hozelock_controller_0_ispanelremoved:
friendly_name: "Panneau retiré"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isPanelRemoved"] }}'
hozelock_controller_0_isadjusted:
friendly_name: "Ajustement"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isAdjusted"] }}'
hozelock_controller_0_isscheduleuptodate:
friendly_name: "Calendrier à jour"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isScheduleUpToDate"] }}'
hozelock_controller_0_ispaused:
friendly_name: "En pause"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["isPaused"] }}'
hozelock_controller_0_nextwateringevent_enabled:
friendly_name: "Prochain arrosage activé"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["nextWateringEvent"]["enabled"] }}'
hozelock_controller_0_currentwateringevent_enabled:
friendly_name: "Arrosage en cours activé"
value_template: '{{ state_attr("sensor.hozelock_controller_0", "controller")["currentWateringEvent"]["enabled"] }}'
###############################################################################
# AUTOMATIONS
###############################################################################
automation:
- id: notification_debut_arrosage
alias: Notification début d'arrosage
trigger:
- platform: state
entity_id: binary_sensor.hozelock_controller_0_iswatering
to: 'on'
action:
- delay: '00:00:10'
- service: persistent_notification.create
data_template:
title: Hozelock
message: "{{ states('sensor.hozelock_controller_0_currentwateringevent_starttime') }}: début d'arrosage pour une durée de {{ states('sensor.hozelock_controller_0_currentwateringevent_duration') }} min"
###############################################################################
# SCRIPTS
###############################################################################
script:
# Hozelock
hozelock_waternow:
alias: Démarrer arrosage manuel
sequence:
- service: rest_command.hozelock_waternow
data_template:
hub_id: !secret hozelock_hub_id
controller_id: 0
duration: "{{ states('input_number.hozelock_duration') | int * 60000 }}"
hozelock_stopwatering:
alias: Arrêter arrosage manuel
sequence:
- service: rest_command.hozelock_stopwatering
data_template:
hub_id: !secret hozelock_hub_id
controller_id: 0
hozelock_pause:
alias: Suspendre arrosage
sequence:
- service: rest_command.hozelock_pause
data_template:
hub_id: !secret hozelock_hub_id
controller_id: 0
duration: "{{ states('input_number.hozelock_duration_pause') }}"
hozelock_unpause:
alias: Reprise arrosage
sequence:
- service: rest_command.hozelock_unpause
data_template:
hub_id: !secret hozelock_hub_id
controller_id: 0
And the UI:
I’m sure someone else could do better