AlexxIT / SSHCommand

Run any SSH command on remote server from Home Assistant service call
https://github.com/AlexxIT/Blog
MIT License
93 stars 8 forks source link

225 char limit #14

Closed alanmilinovic closed 1 year ago

alanmilinovic commented 1 year ago

I am getting "Invalid state encountered for entity ID: sensor.xxx. State max length is 255 characters."

Any idea how to solve it?

AlexxIT commented 1 year ago

This integration does not provide sensors

alanmilinovic commented 1 year ago

Sorry, I think I made issue in wrong repo. I am also using your PythonScriptsPro.

AlexxIT commented 1 year ago

In PythonScriptsPro you set the name manually with the name yaml parameter.

alanmilinovic commented 1 year ago

In PythonScriptsPro you set the name manually with the name yaml parameter.

Hm, this is what I an doing now in python script. self.state = f"\n{ resp.decode() }"

So I m using ssh command with python script pro.

Maybe I can set self.attributes instead? Not sure what is the syntax.

AlexxIT commented 1 year ago

Oh. It is about value of sensor. I thought is is about name of the sensor. You can do something like this:

self.state = f"\n{ resp.decode()[:250] }"

Also you may try to set:

self._attr_extra_state_attributes = { "response": resp.decode() }
alanmilinovic commented 1 year ago

Wow, that worked. Many thanks!