Closed dominig closed 1 year ago
HASS entities (state variables) can store strings with commas. It's likely your code has a bug. From the trace, you appear to be calling split()
and map()
. Please include your code and the actual error message.
I ended by using an array which has worked. I found out that side issues can easily be induced by persistant variable as there no clear method to change them during the development process. It might have been the origin of my issues. Removing the requirement of persistant data has fixed all issues. Now my code is fully operational. https://github.com/dominig/pyscript_power_load_balance
As I need to store and share between several triggers a list of toogle (0/1), I tried to use a comma separated list that could easily be converted from a string to a list and vice versa. I have discovered (after a long try and error session) that I can store in state variable attribute a string (255 char max) only if that list is using space as a separator and not comma. I could not read my list from Pyscript if this one was comma separated. Using space separator works fine. I do not know if it's a bug or a constrains inherited from HACS but easer way it would be good to get it known.
The following python line radiator_actual_mode_state=state.get('pyscript.radiator_status.radiator_actual_mode') Will work fine is the attribute radiator_actual_mode' of the state variable pyscript.radiator_status is 0 0 0 0 0 0 and crashes it is 0,0,0,0,0,0 As shows the log extract below.