bitfocus / companion-module-homeassistant-server

MIT License
12 stars 7 forks source link

Dynamic Variable Value not the Value #6

Closed billmans closed 2 years ago

billmans commented 3 years ago

Just started using this so I might just be using wrong - in Companion the values for the dynamic variable seem to be the names of the entity in HA, not the value? ie: (Description = Entity: My Office Lights Current value = My Office Lights)

So, if I have a button to control a light - it works, but if I turn on the light in HA, the button Companion does not reflect this.

Using latest edition of HA

royvandongen commented 2 years ago

I'm seeing the same behaviour, where the "value" of the variable seems to be filled with a copy of the variable name. I believe this is an error. Lets hope it will get fixxed soon! @Julusian is this something that is easy to fix?

Julusian commented 2 years ago

Sorry, I've not had much time to do anything to this module recently.

The variables are intended to be the names of entities, as depending on how you change the name in HA they can be vastly different. For example some of the ones I have:

I personally use these variables to label the buttons so that the they always match the naming I have set in HA. To me this is working as intended. I think that the correct thing to do here would be to add another set of variables containing the value of each entity. This should be pretty easy to do, but I do not know when I will have the time to do it

royvandongen commented 2 years ago

So, i was just testing with changing the source, and i fixed it for me. However, in order to make this a structural fix i would need to break the backwards compatibility. Is that worth a pull request @Julusian? Reason for breaking the backwards compatibility: the "value" of the entity variable would then become the state (which makes more sense in a homeassistant way of thinking) and the friendly_name would become a sub-variable.

Julusian commented 2 years ago

This is implemented in the 3962 beta build.

A new variable has been added with the value