command_line:
- binary_sensor:
name: Sun
scan_interval: 600000000
command: "/Users/server/scripts/sun.sh"
value_template: "{{ value }}"
payload_on: "True"
payload_off: "False"
unique_id: sun
Any idea why this is not working since a few updates ago?
The script will not run and the state never changes. I can run the script manually and it works, but if I refresh the sensor, it doesn’t.
Interval set to 60 works as well, but that is not an option.
koying
(Chris B)
June 11, 2023, 9:09am
2
What do you mean by that?
You realize that 600000000 seconds means ~19 years, right?
Yes, the idea is that I can only request an update manually. However the script doesn’t run. It checks an image which is then deleted. This is never done when updating manually. It worked before though.
koying
(Chris B)
June 11, 2023, 9:22am
4
So by “refresh the sensor”, you mean in an automation like this, using the homeassistant.update_entity
service, right?
- id: 'ce0e40ef-74f5-487b-899d-1ab66f2e0fd7'
alias: 'Update speedtest'
mode: restart
trigger:
- platform: time_pattern
hours: "/3"
action:
- delay: "00:06:14"
- service: homeassistant.update_entity
target:
entity_id: sensor.speedtest_download
You should be consistent in you wording or show the code
Exactly I am using homeassistant.update_entity
.
By running the script manually I mean the shell script outside from HA. Sorry for the confusion.
koying
(Chris B)
June 11, 2023, 9:32am
6
Ok. And by “a few updates”, you mean?
command_line
has changed in 2023.6…
koying
(Chris B)
June 11, 2023, 9:39am
7
You tried to execute the service manually as well and it didn’t work, right?
Possibly, I had some issues before, but that might be unrelated.
And yes, I ran the service manually and that didn’t work. As if the script isn’t run by HA.
123
(Taras)
June 11, 2023, 12:22pm
9
It’s been reported as an Issue (bug):
opened 03:38PM - 08 Jun 23 UTC
integration: command_line
### The problem
Consider this sensor:
```
command_line:
- sensor:
… name: "test command line10"
command: "echo 123"
value_template: >-
{{ value }} - {{now()}}
scan_interval: 99999
```
It is not updated by calling the service.
Right after HA restart:
![image](https://github.com/home-assistant/core/assets/71872483/12230167-6f24-44ed-8887-1180b63baaa9)
After calling a service:
```
service: homeassistant.update_entity
data: {}
target:
entity_id: sensor.test_command_line10
```
![image](https://github.com/home-assistant/core/assets/71872483/02165568-755b-498e-bc34-cce9c3aa87ff)
i.e. a value is not changed.
### What version of Home Assistant Core has the issue?
2023.6.0
### What was the last working version of Home Assistant Core?
2023.5.x
### What type of installation are you running?
Home Assistant Container
### Integration causing the issue
command_line
### Link to integration documentation on our website
https://www.home-assistant.io/integrations/command_line/
### Diagnostics information
_No response_
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
There’s a related bug:
opened 02:03AM - 08 Jun 23 UTC
integration: command_line
### The problem
my configuration.yaml:
```
...
command_line: !include comman… d_line.yaml
...
```
my command_line.yaml:
```
- sensor:
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
# If errors occur, make sure configuration file is encoded as UTF-8
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}"
```
On a fresh restart, the sensor is working.
If i reload the command_line configuration into the developer tools, the sensor will became unavailable.
May be related to #94082
### What version of Home Assistant Core has the issue?
core-2023.6.0
### What was the last working version of Home Assistant Core?
core-2023.5.0
### What type of installation are you running?
Home Assistant Supervised
### Integration causing the issue
command line
### Link to integration documentation on our website
https://www.home-assistant.io/integrations/command_line/
### Diagnostics information
_No response_
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
```txt
no additional error logs are present reloading the command line configuration
```
### Additional information
_No response_
3 Likes