Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Polling Automation not working #946

Open
ddaddy opened this issue Apr 22, 2024 · 6 comments
Open

Dynamic Polling Automation not working #946

ddaddy opened this issue Apr 22, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@ddaddy
Copy link
Contributor

ddaddy commented Apr 22, 2024

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.

@ddaddy ddaddy added the enhancement New feature or request label Apr 22, 2024
@sgriessini
Copy link

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).

@ddaddy
Copy link
Contributor Author

ddaddy commented Apr 23, 2024

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

@sgriessini
Copy link

You have to use the VIN attribute: state_attr('binary_sensor.jess_online','vin')

@ddaddy
Copy link
Contributor Author

ddaddy commented Apr 23, 2024

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') }}

@ddaddy
Copy link
Contributor Author

ddaddy commented Apr 24, 2024

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

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.

@ddaddy
Copy link
Contributor Author

ddaddy commented Apr 24, 2024

I have updated the Wiki with the latest sensor names.
(I was surprised it let me just edit it without a pull request!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants