Running a powershell script via HASS.Agent causes it to run script more than once.

I have a script which outputs text to a text file with including the time that the log happened. When running this via PowerShell by itself, it works perfectly fine. When running via Hass.Agent it repeatedly runs. This is a HASS.Agent sensor which retrieves data for Home Assistant whilst also writing to a log file of the result.
No description
Solution:
GitHub
Fix: sensor being updated constantly when value doesn't change by a...
This PR fixes issue where the "LastUpdated" value is not updated if sensor value is same as previously. Thanks to Shupershuff for reporting the issue :) Due to this issue sensor's &qu...
Jump to solution
13 Replies
DrR0x
DrR0x10mo ago
Interesting @Amadeo ? Is there something weird because of the PowerShell script?
Amadeo
Amadeo10mo ago
Hard to say without having the script to review And then hopefully replicate the issue
Shupershuff
ShupershuffOP10mo ago
here's a very basic script you can use to replicate the issue I add it as a sensor on a 30 second timer in hass.agent:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File '"C:\testing\outfilebasic.ps1"'
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File '"C:\testing\outfilebasic.ps1"'
Shupershuff
ShupershuffOP10mo ago
Hass.agent then runs the script every 5 seconds
No description
Shupershuff
ShupershuffOP10mo ago
definitely a bug within hass.agent. seems to use the 'Update every x seconds' value for the first time and then just reruns on repeat
Amadeo
Amadeo10mo ago
thx, I'll try to reproduce that in a sec yeah
Amadeo
Amadeo10mo ago
so, the issue is that lastupdate timestamp is "updated" only if value changes and message is actually sent since the returned value doesn't change, timestamp is not updated and yeah that's like a one line fix
Amadeo
Amadeo10mo ago
although I wonder how many ppl used it as a bug-feature @Shupershuff gib github handle please if you have one
Solution
Amadeo
Amadeo10mo ago
GitHub
Fix: sensor being updated constantly when value doesn't change by a...
This PR fixes issue where the "LastUpdated" value is not updated if sensor value is same as previously. Thanks to Shupershuff for reporting the issue :) Due to this issue sensor's &qu...
Shupershuff
ShupershuffOP10mo ago
I love that "testing banana" made it's way into the pull request hahaha it's also Shupershuff
Want results from more Discord servers?
Add your server