Skip to content
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

Added Home-Assistant autodiscovery MQTT #2

Merged
merged 3 commits into from
Jan 27, 2024
Merged

Conversation

FastFrank
Copy link

Hello,

i added some code for HA autodiscovery so the Classic shows up as a MQTT device.
It also sends different icons for the chargestate and SOC.

image

Do you (eode) use HA?

Greetings!
(and thank you for fixing the python 3 stuff)

Copy link
Owner

@eode eode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your changes! After review issues are addressed I'll do a PR upstream.

Yes, I use HA myself -- currently, I'm doing some of this info in HA templates (like the charge state text), but I think it's a decent idea to move it into MQTT.

code/Python/classic_mqtt.py Outdated Show resolved Hide resolved
code/Python/classic_mqtt.py Outdated Show resolved Hide resolved
code/Python/support/classic_jsonencoder.py Outdated Show resolved Hide resolved
code/Python/support/classic_jsonencoder.py Outdated Show resolved Hide resolved
code/Python/support/classic_jsonencoder.py Outdated Show resolved Hide resolved
code/Python/support/classic_modbusdecoder.py Outdated Show resolved Hide resolved
code/Python/support/classic_modbusdecoder.py Outdated Show resolved Hide resolved
@eode
Copy link
Owner

eode commented Jan 26, 2024

Sweet. Overall, it looks good enough at this point. But, I would like to lock these changes behind a CLI flag, like --homeassistant.

After that, I'm ok with it as-is.

@eode
Copy link
Owner

eode commented Jan 27, 2024

I can merge this now -- thanks for all of your work on it!

I do still have some small areas of contention, but you might have your reasons for them -- For example, I think the SOC should perhaps be HA's device_class battery, and its icon should then automatically reflect the state.. ..but if we want to refine that, we can do it in another PR.

Thanks for your contribution!

@eode eode merged commit 1a3261a into eode:master Jan 27, 2024
@FastFrank
Copy link
Author

I can merge this now -- thanks for all of your work on it!

I do still have some small areas of contention, but you might have your reasons for them -- For example, I think the SOC should perhaps be HA's device_class battery, and its icon should then automatically reflect the state.. ..but if we want to refine that, we can do it in another PR.

Thanks for your contribution!

I am glad i can contribute...
I did not know that HA has a battery device_class... i am trying it now...
But... i did make it the way that if the Charge State is Charging the icon contains the lightning symbol and if the classic is not charging is does not contain the lightning symbol.

Maybe one day we can reach the point that it is possible to write to the register to change the settings of the Classic.

Thanks!

@FastFrank
Copy link
Author

It turned green on the graph thing...

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants