-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update hass_mqtt.py #296
Update hass_mqtt.py #296
Conversation
Hi @jblance I'm using your great work for collecting inverter data into Home Assistant (HA), but I also like to improve it a bit: 1) I think, if we use "binary_sensor" instead of "sensor" for boolean parameters in the mqtt topics, HA will discover them as binary sensors, too. We should then see a blue/yellow eye icon depending on state and 'state_color: true' in the entity card. [https://www.home-assistant.io/integrations/binary_sensor/] [https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery] 2) Parameters/Entities without unit don't need and better don't have "unit_of_measurement" declaration. Even with an empty "" unit statement HA uses them as with unit. So the history graph card in HA then shows an empty line graph instead of a horizontal bar chart. e.g.: https://imgur.com/3ha8K97 original graph and above a bar of a copy as a template entity without "unit_of_measurement" (sadly no change in the given time) [https://www.home-assistant.io/dashboards/history-graph] I hope you can agree with my point of view, because I absolutely don't know how to change this in my running installation! And because I don't speak python you better doublecheck my changes! (There's no endif, isn't? Is it just the four spaces to right/left for loops?) And if you take over my changes, I just have to enter "sudo pip install -U mppsolar" and "systemctl --user restart mpp-solar" to update and restart mpp-solar on my pi? Last but not least: The PI30 command QMN queries the Inverter Model. This isn't included in your code and I didn't find the right file/place for a proposal. Maybe you find some time to add this. But while it's very clear to read (just with leading "(" and ending "³", it's no problem for me.
thanks for the improvements
these sound good
yes spacing is critical for python, loops are defined visually
you code is a little messed up, but I get what you mean, I will incorporate your changes directly and get a new version packaged
oh, I'll get that added to PI30 |
😎
But of couse it's your's, feel free to make it like you want to! 👍 Thank you very much in advance! |
Yeah, but its simpler to go
and there is a few lines in the bool logic that are common, so can be pull out a level - dont take it as a criticism any help is appreciated, its just the code is complicated anyway so I try my best to make it as simple as possible (especially regard duplication) otherwise weird bugs can occur. |
er scratch all that, I see why you did it this way now - good job and ignore me |
@michas79de See also #243 |
I did'n knew that, when I startet with mpp-solar. But now I'm using a lot of the sensors in cards, graphs or other sensors in HomeAssistant. So I don't want to change them all again. |
Just change to Sooner or later hass_mqtt will migrate to hassd_mqtt. |
Hi @jblance
I'm using your great work for collecting inverter data into Home Assistant (HA), but I also like to improve it a bit:
I think, if we use "binary_sensor" instead of "sensor" for boolean parameters in the mqtt topics, HA will discover them as binary sensors, too. We should then see a blue/yellow eye icon depending on state and 'state_color: true' in the entity card. [https://www.home-assistant.io/integrations/binary_sensor/] [https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery]
Parameters/Entities without unit don't need and better don't have "unit_of_measurement" declaration. Even with an empty "" unit statement HA uses them as with unit. So the history graph card in HA then shows an empty line graph instead of a horizontal bar chart. e.g.: https://imgur.com/3ha8K97 original graph and above a bar of a copy as a template entity without "unit_of_measurement" (sadly no change in the given time) [https://www.home-assistant.io/dashboards/history-graph]
I hope you can agree with my point of view, because I absolutely don't know how to change this in my running installation! And because I don't speak python you better doublecheck my changes! (There's no endif, isn't? Is it just the four spaces to right/left for loops?)
And if you take over my changes, I just have to enter "sudo pip install -U mppsolar" and
"systemctl --user restart mpp-solar" to update and restart mpp-solar on my pi?
Last but not least:
The PI30 command QMN queries the Inverter Model. This isn't included in your code and I didn't find the right file/place for a proposal. Maybe you find some time to add this. But while it's very clear to read (just with leading "(" and ending "³", it's no problem for me.