Hello all… likely to be the noob-est of noob questions so apologies but I am attempting to add coding to let me ‘boost’ a group of my Hive TRVs.
A quick search and found some coding to start with but I’ve fallen at the 1st hurdle… the coding beings with “script:” and I have a “script: !include scripts.yaml” elsewhere in the file so it is giving me a ‘duplicate key’ error. I’d be very grateful if someone could point out the error of my ways!
Many thanks in advance.
This is the test in the file:
(Hoping I have copy and pasted this correctly)
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
sensor:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /config
- type: memory_use_percent
- type: processor_use
# script
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
# Hive
script:
boost_heating:
sequence:
- service: hive.boost_heating_on
target:
entity_id: "climate.heating"
data:
time_period: "01:30:00"
temperature: "20.5"
You have a file called script.yaml where you should put your script
Ah… so scripts go in there! Thank you.
This line of code in your config.yaml file is basically telling it where to look to find any scripts you may have.
script: !include scripts.yaml
What you need to do is copy the code below into your scrips.yaml file and remove it from your config.yaml file.
config.yaml file content should look like this
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
sensor:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /config
- type: memory_use_percent
- type: processor_use
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scripts.yaml file should include this
boost_heating:
alias: boost group hive TRV
sequence:
- service: hive.boost_heating_on
target:
entity_id: "climate.heating"
data:
time_period: "01:30:00"
temperature: "20.5"
That’s brilliant thanks so much!
I’ve got this now in my scripts file:
boost_heating:
alias: boost downstairs heating
sequence:
- service: hive.boost_heating_on
target:
entity_id: "climate.dining_room_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
I’d like to add more devices to run when the script is activated, can I repeat the ‘service’ line for subsequent devices as below? Seems to be the only way that doesn’t generate errors:
boost_heating:
alias: boost downstairs heating
sequence:
- service: hive.boost_heating_on
target:
entity_id: "climate.dining_room_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
entity_id: "climate.living_room_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
entity_id: "climate.kitchen_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
entity_id: "climate.utility_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
entity_id: "climate.hall_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
entity_id: "climate.office_trv"
data:
time_period: "02:00:00"
temperature: "25.0"
- service: hive.boost_heating_on
target:
- climate.dining_room_trv
- climate.living_room_trv
- climate.kitchen_trv
- climate.utility_trv
- climate.hall_trv
- climate.office_trv
data:
time_period: "02:00:00"
temperature: "25.0"
1 Like
OK… so when I do that I get ‘duplicate key’ errors against each entity id…
No worries, they code I put (with them all as separate services) does seem to work but it is obviously a lot more cumbersome!
Is there a way I can pull the remaining time from the ‘time_period:’ and have this display somehow?
123
(Taras)
December 27, 2021, 12:59pm
11
You can do it like this:
- service: hive.boost_heating_on
target:
entity_id:
- climate.dining_room_trv
- climate.living_room_trv
- climate.kitchen_trv
- climate.utility_trv
- climate.hall_trv
- climate.office_trv
data:
time_period: "02:00:00"
temperature: "25.0"
2 Likes
That’s great, thanks! Certainly trims down the size.