so i made automation and group to use with unraid to turn on remote shares until they are on.. i trying to simulate like windows if a drive letter cant connect to the server it will keep trying to re connect till its connect ... i using this with unraids unassigned devices remote shares it doesnt have a built in re try mount and doesnt look they interested in adding.. but my configuration isnt working right i tried google to help to get the value template
so how it works is i got a group of toggle switchs and when home assistant boots or if mounting doesnt work
then turn the toggle... then wait 20 seconds and keep retrying till they are all on and stay on
i guess id like automation that polls incase the detecting if if a switch has toggled to off..
so not sure if best route is HA or the node red automation
Have you tested that template? I don't think it will ever render anything but true, so it will never actually fire.
Another issue could be the group. Which state behavior is the group using "any" or "all"? Based on the condition of the until I would guess it's supposed to be all, but is it?
alias: "!!! Test automount group"
description: ""
triggers:
- trigger: template
value_template: |
{{ state_attr('group.k9_server_remote_share_automount', 'entity_id')
| select('is_state','off') | list | count > 0 }}
for: "00:00:30"
- trigger: homeassistant
event: start
conditions: []
actions:
- repeat:
until:
#For this condition to work the group's state behavior needs to be "all"
- condition: state
entity_id: group.k9_server_remote_share_automount
state: 'on'
for: "00:00:20"
sequence:
- action: homeassistant.turn_on
entity_id: |
{{ state_attr('group.k9_server_remote_share_automount','entity_id')
| reject('is_state','on') | list }}
continue_on_error: true
- delay: 20
mode: single
@Didgeridrew@Sir_Goodenough
no it doesnt work orginally i had just entity: group.xxxx
as the trigger but i remember from previous things like learned for my wled i need that select etc.. the triggering group wasnt always working
as all i need it to do is if any of the entities change i guess from unavalble to off or off to unavaliable or on to off etc
then toggle them all on and check if they are all on and if not keep looping every 20 seconds
so basiclly loop until all of the entites are in the ON position and the delay i put in to wait as i know if an entitiy not avaliable and you toggle on it will auto toggle off after like 3 4 seconds.. so that is my check delay for 20 seconds for if it cant mount and keep looping until they are all in the ON pos and stay on for 20 seconds
and this is my group of switchs that are linked to the unraid server remote shares
also i like it to poll too cuz i notice sometimes HA doesnt detect a change of entity changes sometimes.. so a poll like every 5 min to see if those in the group are on if not run the automaton till it is
so i tried paying with just hard coding since group wasnt always working but this isnt workight right either.. it polls ever 5 min and its supposed to check all of them if they are unknown off or unavaliable and if they are to switch on and wait 20 seconds and if its still on to exit
but its really only doing the first one its not checking all of them.. since i polling and just check if its "off"
but how do i do that and perferable in a group so i dont have to repeat the code so much
i just scrolled up i didnt see your reply as i dont get updates and pages dont refresh so i just added to the bottom of my writtings.. ill go test yours
ill try it all.. i sorry i didnt see it.. it showed up after i hit refresh
@Didgeridrew to your code i copied cant be run its
Message malformed: not a valid value for dictionary value @ data['actions'][0]['repeat']['sequence'][0]['entity_id']
as to your question about state behavior i have no idea?
i made
a group
so if all of them were off then turn them all on .. if 2 on then trying to turn the other ones on.. but if its too complicated then id do a different way of doing it
@Didgeridrew so i tried to figure out how to fix that malform i couldnt
but i noticed your automation is to loop until the group. is on.. but apparently its always on from what i see even if switchs are off in the group.. the group state is on... so it wouldnt run if it did cuz even if all switchs but 1 are off the group is on i noticed
so if all switchs are off.. it goes "off" for the group.. if one turns on the the group is on...
maybe easier just to make 1 automation per switch i guess? and forget the group? i dunno i just playing around at the moment
Is there a reason you are using the old style groups when you don't have to and they are no longer recommended? All your entities are switches, so you can just use a Switch Group Helper.
@Didgeridrew
didnt know there is a change.. not like i read every update i just update homeassistant and if i create a group its like once or twice a year so i d didnt know of changes..
i did try this which seems to work.. ill look up the switch group.
and see how it works
alias: "!!!!!remount test"
description: ""
triggers:
- trigger: time_pattern
seconds: /20
conditions:
- condition: or
conditions:
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_backup_files
state: "off"
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_family_files
state: "off"
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_music
state: "off"
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_tdarrtemp
state: "off"
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_temp
state: "off"
- condition: state
entity_id: switch.k_9_remote_share_192_168_0_3_videos
state: "off"
actions:
- action: homeassistant.turn_on
metadata: {}
target:
entity_id: group.k9_server_remote_share_automount
data: {}
mode: single
i made switch group i was able to add those entitys so its switch.remote_share_group_helper
i find no matter what if all the switchs are off but one that switch group is still on i guess best way is what i got
poll every 20 seconds or ill change poll every 5 min and check the indvidual and then group toggle that switch group..
guess making it small foot print not always the easiest... but my last coding seems to be working using the turn on switch for the group switch you told me about...
i appreciate your help so far.. always learning something new