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

Support writing of Charger Times to the Inverter #27

Closed
wills106 opened this issue Feb 21, 2022 · 19 comments
Closed

Support writing of Charger Times to the Inverter #27

wills106 opened this issue Feb 21, 2022 · 19 comments
Labels
enhancement New feature or request

Comments

@wills106
Copy link
Owner

The problem though is that I have not worked out an easy way to program them within HA.
The first problem is that for built in Integrations (custom_components) there is no equivalent to input.date_time so I would either need a separate number entry for hours and mins for each time block. So a total of 8 number.solax_
Which would result in quite a messy user interface.

The other option is to look into how I monitor a user created input.date_time
Which would either need the user to follow an exact naming convention, or for the option to put in the various input.date_time into the initial Integration Configuration page. So it knows what to monitor.

Then to complicate things more SolaX decided that while you read hours as a single 16bit entry and minutes as another 16bit entry, you program both the hours and minutes for a timeslot as a single 16bit number. Using hi 8bit for mins and the low 8bit as the hours.

So if you want to program the Start Time of Slot 1 you need to do the following for 09:10 am

Hbyte = 10
Lbyte = 9
value = Hbyte << 8 | Lbyte;

Which gives you the number of 2569 which is what you program to the corresponding register.

@wills106 wills106 added the enhancement New feature or request label Feb 21, 2022
@wills106
Copy link
Owner Author

Release 0.4.4 Starts to partially address this issue, but in a crude hard encoded way.

@wills106
Copy link
Owner Author

Just checked over the docs. Gen2 & Gen3 uses Lo for hours and Hi for mins. But Gen4 has swapped it to Lo for mins and Hi for hours...

Will need a separate "TIME_OPTIONS" for Gen4 ie "TIME_OPTIONS_Gen4"

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@wills106
Copy link
Owner Author

It's only meant as a quick stop gap, I'll do the same for Gen4 for the time being.
At least we have partial functionality even if it's in 15min chunks. Should cover most use cases?

I guess it depends if the HA mods would allow this method in an official Integration?
Hopefully date_time will end up as a proper entity as some point in the near future. I know it's been asked a number of times in the Dev Chat on Discord.

@infradom
Copy link
Collaborator

Thanks, yes, indeed this should cover most cases !

@wills106
Copy link
Owner Author

Do your times (discharger_start_time_2 etc) report back as 01:05 or 1:5?

I had to pad out the ones for Gen2 / Gen3 as the Inverter's return the values without the leading zero.

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@wills106
Copy link
Owner Author

It's annoying they keep switching things. Like the above mentioned flip of Hi and Lo for the hours and mins.

I have added in the Gen4 times & selects. Hopefully they are correct.
I have not added it to a release yet. Could you let me know if they look correct?

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@wills106
Copy link
Owner Author

So potentially TIME_OPTIONS_GEN4 isn't needed?

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@wills106
Copy link
Owner Author

I am not sure if the documentation is correct ....

Wouldn't be the first time

@infradom
Copy link
Collaborator

infradom commented Feb 24, 2022 via email

@wills106
Copy link
Owner Author

Thanks for validating that.

Once I have confirmation that Gen2 works the same as Gen3 I'll release it all as 0.4.5

@AviadorLP
Copy link

AviadorLP commented Mar 2, 2022

Since you are changing times to full digits can you do that to the sensor.solax_rtc please ?
already done the change to your code but don't know if it affects anything else.

        rtc_seconds = str(decoder.decode_16bit_uint())
        self.data["rtc_seconds"] = rtc_seconds
        
        rtc_minutes = str(decoder.decode_16bit_uint())
        rtc_hours = str(decoder.decode_16bit_uint())
        rtc_days = str(decoder.decode_16bit_uint())
        rtc_months = str(decoder.decode_16bit_uint())
        rtc_years = str(decoder.decode_16bit_uint())
        
        self.data["rtc"] = f"{rtc_hours.zfill(2)}:{rtc_minutes.zfill(2)}:{rtc_seconds.zfill(2)} {rtc_days.zfill(2)}/{rtc_months.zfill(2)}/{rtc_years.zfill(2)}"

@wills106
Copy link
Owner Author

Closing down due to being on the Todo List #37 for further investigation.

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

No branches or pull requests

3 participants