bingo i guess, this is 84.3…
now what are the old ones… Ill dive into this later on
though they seem to be available?
installed it on my 90.2 instance and it seems to be working!
One big issue though, the media_duration isn’t set in this sequence, so it takes the duration (if at all, if a fine has not been played yet, the attribute isn’t set yet, as mentioned earlier) of the prvious file.
In my other setup, this only happens the first time, and in the rest of the looping, attribute is set correctly, and looping is great.
in the timer setup this doesn’t happen and the timing stays determined by the previous file, played outside this looping sequence.
ive tried to add the script.sound_bite (which plays the file once, and thus should set its duration attribute) and see if that would set the duration, but it obviously doesn’t…dont now why yet.
secondly: I still don’t get a notification when the boolean is turned_off. Could this have to do with the fact that there’s a timer duration being set, while the the timer is turned_off? maybe that isn’t as it should be? And we should change that template. According to the docs, the entity_id should be inline with the service: so maybe this?:
- service_template: >
{% if is_state('input_boolean.loop_sound_bite_timer','on') %} timer.start
{% else %} timer.finish
{% endif %}
entity_id: timer.looper
data_template:
duration: >
{% set x = state_attr(states('sensor.sound_bite_player'),'media_duration')|round|int %}
{{ x | timestamp_custom('%H:%M:%S', false) }}
If I enter the current automation in dev-template it does show correctly:
using this:
- alias: 'Looping controller'
id: 'Looping controller'
initial_state: 'on'
trigger:
platform: state
entity_id: input_boolean.loop_sound_bite_timer
condition: []
action:
# have the soundfile played once to set the 'media_duration' attribute
- service_template: >
{% if is_state('input_boolean.loop_sound_bite_timer','on') %} script.sound_bite
{% else %} script.dummy
{% endif %}
- service_template: >
{% if is_state('input_boolean.loop_sound_bite_timer','on') %} timer.start
{% else %} timer.finish
{% endif %}
# {{'timer.start' if states('input_boolean.loop_sound_bite_timer') == 'on' else 'timer.finish'}}
data_template:
entity_id: timer.looper
duration: >
{% set x = state_attr(states('sensor.sound_bite_player'),'media_duration')|round|int %}
{{ (x if states('input_boolean.loop_sound_bite_timer') == 'on'
else 0 )| timestamp_custom('%H:%M:%S', false) }}
- condition: template
value_template: >
{{is_state('input_boolean.notify_developing','on')}}
- service: notify.marijn
data_template:
message: >
Loop boolean changed to {{states('input_boolean.loop_sound_bite_timer')}}
concerning the second issue of the boolean not triggering the ‘off’ state, Ive tested with this dummy automation, and that works as expected:
- alias: 'Looping controller dummy'
id: 'Looping controller dummy'
initial_state: 'on'
trigger:
platform: state
entity_id: input_boolean.loop_sound_bite_timer
condition: []
action:
# have the soundfile played once to set the 'media_duration' attribute
- service_template: >
{% if is_state('input_boolean.loop_sound_bite_timer','on') %} script.dummy
{% else %} script.dummy
{% endif %}
- service_template: >
{% if is_state('input_boolean.loop_sound_bite_timer','on') %} timer.start
{% else %} timer.finish
{% endif %}
entity_id: timer.looper_dummy
- condition: template
value_template: >
{{is_state('input_boolean.notify_developing','on')}}
- service: notify.marijn
data_template:
message: >
Looper dummy boolean changed to {{states('input_boolean.loop_sound_bite_timer')}}
so that also points to the action part not being as it should.