Dynamic Polling Automation not working
I am setting up the Dynamic Polling as explained here: https://github.com/alandtse/tesla/wiki/Dynamic-Polling-Frequency
When I run the action of an automation to set it to 30s I see no difference. I also get the error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'entity_id'
What exactly is the binary_sensor referred to in these lines?
action:
- delay: '00:01:00'
- service: tesla_custom.polling_interval
data:
vin: "{{ state_attr('binary_sensor.' ~ trigger.entity_id.split('.')[1].split('_')[0] ~ '_online_sensor','vin') }}"
scan_interval: 30
I have no sensor ending with _online_sensor. Has this perhaps been renamed?
I also have no entity called tesla_custom.polling_interval.
You should use the name of your binary sensor (depends on the name of your integration). For my integration it is binary_sensor.model_y_online (maybe the code above is a little bit outdated).
Ah ok. I guess the _sensor ending has been removed.
So I have this which seems to make the HA UI happy:
action:
- delay: "00:01:00"
- service: tesla_custom.polling_interval
data:
vin: binary_sensor.jess_online
scan_interval: 30
You have to use the VIN attribute: state_attr('binary_sensor.jess_online','vin')
Ah yes, that makes sense now.
Is there any way to view the current polling interval to make sure it's worked?
This template just gives unknown
{{ state_attr('tesla_custom.polling_interval', 'MYVIN') }}
Ah ok. I guess the
_sensorending has been removed.So I have this which seems to make the HA UI happy:
action: - delay: "00:01:00" - service: tesla_custom.polling_interval data: vin: binary_sensor.jess_online scan_interval: 30
In case anyone else looks this up. This wasn't actually working as it needs to be written as"
action:
- service: tesla_custom.polling_interval
data:
vin: "{{ state_attr('binary_sensor.jess_online','vin') }}"
scan_interval: 30
It would be good to have access to the polling interval through a sensor.
I have updated the Wiki with the latest sensor names. (I was surprised it let me just edit it without a pull request!)