-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Consider user defined scan_interval 8000 for command_line sensor. #2994
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
Conversation
Does this mean that the user can add the add the |
Yes, exactly. Sorry I didn't include an example config, I thought this was unnecessary because according to the documentation linked in the description, this should have already been possible. |
There are other sensors that have a similar restriction (e.g., Rest Sensor). Will it affect them as well? |
No, this change is specific to the command_line sensor. |
Can you try to make the default 60 seconds? Adding a |
👍 |
Thank you all for the input/feedback. Will try to do that. |
I was thinking that it will be nice to make similar changes to the REST sensor (provide user defined scan_interval). I can create a PR if that is something we would like to see. |
Instead of using a schema, just add |
If I understand that right, it's probably the easiest approach to just abort this pull request and open a new one. The merge of pr #2968 fundamentally changed the command_line sensor (and all other command_line components). Other suggestions? |
|
Hmm. My two commits in here are unnecessary as they changed things from the previous version. So even though I'd take out all changes while rebasing, these commits would remain in the logs. Still ok? |
Yes, just continue on your branch and make sure the end result is fine. Then we'll squash when you're done and it will look like a single commit |
@bliemli Mind fixing merge conflicts? |
@Teagan42 No, not at all. I just wanted to be sure it's ok to leave unnecessary commits in there. Thanks :) |
I just tested the command_line sensor's behaviour from the dev branch without changing anything. It now considers the scan_interval as expected, so @fabaff's changes to use voluptuous already solved this :) |
I can't confirm that this is working correctly, unless I'm missunderstanding how it works. Take the following sensor as an example: - platform: command_line
name: "Hombot Status"
command: "python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_ROBOT_STATE'"
scan_interval: 10
value_template: "{{ value | capitalize() }}" When I run Sep 25 02:43:50 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_ROBOT_STATE'
Sep 25 02:45:00 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_ROBOT_STATE'
Sep 25 02:46:10 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_ROBOT_STATE'
Sep 25 02:47:20 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombo
8000
t_retrieve_status.py 'JSON_ROBOT_STATE'
Sep 25 02:48:30 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_ROBOT_STATE' Another sensor as an example: - platform: command_line
name: "Hombot Battery"
command: "python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC'"
unit_of_measurement: '%'
scan_interval: 30 And the output of Sep 25 02:45:00 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC'
Sep 25 02:46:30 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC'
Sep 25 02:48:00 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC'
Sep 25 02:49:30 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC'
Sep 25 02:51:00 Ra hass[648]: INFO:homeassistant.components.sensor.command_line:Running command: python3 /home/hass/.homeassistant/python/hombot_retrieve_status.py 'JSON_BATTPERC' So looking at the timestamps above, it turns out the actual interval is |
Still seeing the same behaviour on 0.29.6. Any feedback on this? Or should I open a new issue myself? |
You're right, this is not yet working, I probably tested a cached version... |
I'd try to fix it myself if I was clever enough but I'm not lol. So looking forward to a fix, @bliemli I did find a 8000 "dirty fix" in related issue #2499, but I agree with @slash5k1 over there that a rewrite is probably in order. EDIT: seems I may have worked it out after all! Now to see if I can figure out how to make a PR 😉 |
Any reason why this PR was closed? I still notice the behavior that the interval is 70 seconds when I specify 10 seconds as |
Description:
Remove hard coded scan_interval of 60s so the command_line sensor considers either the default value of 30s or a user defined value, as expected according to https://home-assistant.io/topics/platform_options/#scan-interval.