I am trying to set up an automation based on my grid power. Basically…if I export enough I want to turn on some devices. I have the Solaredge integration setup and can see all the values but…I get an error in the automation.
Value cannot be processed as a number: <state sensor.solaredge_grid_power=0.65; status=Active, flow=import, unit_of_measurement=kW, friendly_name=solaredge (Grid Power), icon=mdi:power-plug, device_class=power @ 2020-12-08T13:12:31.818950+01:00> (Offending entity: state("sensor.solaredge_grid_power"))
This is the sensor:
So my trigger should be: if value is lower than -1 it should fire…
This may very well be just a startup error. Home Assistant tries to compare unavailable to -1000, which will work once the state changes from unavailable or unknown (String) to any number.
I guess you could change the below: '-1000' to a higher number so the A/C kicks in, it should work.
I have similar log enties;
Logger: homeassistant.components.template.cover
Source: components/template/cover.py:281
Integration: template (documentation, issues)
First occurred: December 6, 2020, 7:20:00 PM (1 occurrences)
Last logged: December 6, 2020, 7:20:00 PM
could not convert string to float: 'unknown'
But once the REST integration reaches out to retrieve the value, the error becomes irrelevant.
TypeError: '<' not supported between instances of 'str' and 'int
So it seems it gives the value as a string, I do know my way around coding in .NET but…how do I convert the string to a number within Home Assistant and the automation…? (I assume there is a way)
Okay, so it’s a string, that’ll be easy enough.
The screenshot you’ve shared includes sensor.solaredge_grid_power while your automation uses sensor.solaredge_imported_power, is this really the one you want to use? Just making sure.
If so, you can either set up a template sensor like this:
That sounds like the answer I needed. With your explanation, the world of HASS has opened a bit more to me…
I have opted for the first, so created it all in the configuration.yaml and changed my automation to use that. Now rebooted everything and waiting if it will trigger. Since the values are only read every 15 or 30 minutes (not sure) I assume something should happen in the next half hour… I will update here.
EDIT: and yes, I messed around with the automations, trying to use different sensors, that is why there is a difference between the screenshot and the automation. I am using the grid_power one and check if that value is below this -1 kW (for testing I set it to be below 10 kW so it should work).
One thing I noticed…while editing the automations.yaml I also deleted one of my test automations. Now unfortunately it shows up in the UI, but I cannot edit or remove it from there. Seems like kind of an “orphan” and the “reload Automations” option is not available under “server control” anymore"
EDIT2: it works. Only somehow the Condition I wanted to use does not work. I wanted to check for the HVAC Mode being “‘off’” but that prevents the automation from doing anything. If I take the condition out, it works. So…one step further already
When editing automations in the UI, they get loaded immediately and put into the YAML file.
When editing the YAML file manually, you have to reload. So if you edit manually and then use the UI, your first changes will be overriden.
Hope you get the last issue sorted out as well
Personally I like to not use device stuff and stick to entities, makes that a lot cleaner in YAML
Yeah, I understand that. But it somehow now messed up the UI. There is an automation visible which I cannot edit anymore and it is not present in the yaml file. And, as I said, on top of that the button to reload the automations file has disappeared from the UI. I am one of these who get really annoyed by that. And if it had not been for that fact that I made quite a lot of things work today and did NOT make a snapshot before starting this… Well…you get my point. I guess I will revert to an earlier snapshot and just redo what I did today. A second time is always faster, right…
Thanks again!
EDIT: your tip with not using devices, but stick to entities also did the trick with the condition. Checking the entity state is more reliable I guess. So now…all works as I want. Thanks for the help…fantastic community here!