HASS.Agent: Bug: PowershellSensor as Satellite Service - error_during_execution
Describe the bug Powershell sensor does not work as satellite service. It works when Test Command/Script is executed, and it works as a hass.agent sensor.
To Reproduce Steps to reproduce the behavior:
- Go to Satellite Service
- Click on Sensors
- Click on Add New
- Select PowerShellSensor
- Add this as command
$(get-date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss')
- Click Store Sensor
- Click Send & Active Sensors
Expected behavior The date as state in Home Assistant
Screenshots
Misc info (please complete the following information):
- Windows build (ideally screenshot/info of
winver.exe
output): Win10 22H2 - Windows’ UI language: EN
- HASS.Agent version: 2022.14.0
Please check what’s applicable (multiple answers possible):
- Installed via installer
- Installed manually
- Problem occurs in HASS.Agent
- Problem occurs in Satellite Service
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 47
Yeah, using unicode/utf-16 causes “normal” characters to become chinese and using utf-8 causes the chinese characters to be broken. How one cannot love text encoding…
Hopefully this time I got if fully right, added the change to both PRs mentioned before 😃
I believe this is what you are searching for?
I see… well ya gotta love Microsoft Product Names
With the crappy internet connection installation will take a while. I try to get it compiled and tested tomorrow.
But now I finaly know where the Screenshot was taken lol
As requested:
There is indeed differences in the language settings. But as Skons has pointed out, this affects only the Service.
Server
PC

.NET Runtime on the Server is 6.0.3 while on the PC it is 6.0.21
Now let me read up on the remainder of the Thread 😃
Yes
For what its worth, I also found this in regards to the OEMcodePage: https://stackoverflow.com/questions/1812104/relation-between-net-encoding-and-characterset
Fix added to the PR and merged to the bulk PR https://github.com/LAB02-Research/HASS.Agent.Staging/pull/24. Unfortunately for now the only reliable way to get it is to build the project yourself :\ (I don’t recommend accepting exe files/binaries from me or any other random internet user)