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
Request for aditional atributes #3
Comments
I'll add them later this week or next week. |
Bumping this. Thanks again. |
I've added some battery attributes. Tell me if it works, I don't have a battery to test. |
I am so happy to see that you added the battery data management. Thank you so much! |
Are you sure you updated the sensor files? you will need to update the file |
Yes, I replaced the whole files set. |
And did you restart HA? I don't really get that error since the option is right there: CONF_OPTIMIZERS = "optimizers"
CONF_BATTERY = "battery"
...
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_OPTIMIZERS, default=False): cv.boolean,
vol.Optional(CONF_BATTERY, default=False): cv.boolean,
}
) I also tried adding |
I cannot retry now, I will retry soon and I will update you. |
I tried newly.
Logger: homeassistant.components.hassio Invalid config for [sensor.huawei_solar]: [battery] is an invalid option for [sensor.huawei_solar]. Check: sensor.huawei_solar->battery. (See ?, line ?).The same error is showed if I perform the configuration check. |
There's something strange going on if it still shows all the data when the config is supposedly invalid. Maybe some stale information somewhere in |
What if you make a clean development environment like explained in the docs? Do you get the same error there or does it work? |
Unfortunately I am not a developer, I am not able to do what you ask in your last message. |
I checked in the .storage dir and I do not see any filename that seems related to your integration. |
It would be inside one of the files. You could delete the whole folder if you don't care about stored logins, configurations configured with configflow, and any other configuration done through the UI being removed. You could also try to rename the custom component and see what happens. move it to |
ok, I will perform some tests as soon as I will be able. Within a couple of days, I think. |
I tred to rename the custom component /custom_compontents/huawei_solar2, renamed all occurrences of huawei_solar to huawei_solar2 in manifest.json and in my configuration.yaml. |
:/ Any errors in the logs? |
I performed a lot of checks. All run correctly, even with the last integration release, as long as the battery option is set to -false- or commented. |
Ok, if there are no errors with I just checked and found a few issues, what happens now if you put the new |
Same behavior, does not run with battery: true and no error logged. |
There were some other issues with the battery part fixed over the weekend, does it work with the last version? |
I replaced the file sensor.py and I uncommented the battery: true on configuration.yaml. |
I've tried the cchanges and am having some dificulties. From what i could test the sensor times out and HA gives up on it: Setup of platform huawei_solar is taking longer than 60 seconds. Startup will proceed without waiting any longer.` I've instanciated the helper on python command line with Please tell me if i can help in anyway, and thanks again. |
I've taken my tests a bit further and managed to make a working version by adjusting def read_register(self, register, length) on the helper class. After some test, i came to the conclusion that the helper would allways fail the second call after the first opening call, but with no clue on why. I've made some searchs on pymodbus issues related but the threads I manage to find you were actively engaged on already. I adjusted read_register by imposing a wait of 1 (seems to be enougth on my inverter, 0 fails miserably) and i also allways close the connection before returning so a open is forced on each call, with:
Doing this (i just copied and edited the helper code inside the sensor code file) the sensor come up alive. I still get warnings, but it doesnt get killed by HA: Also tested the battery option. Had to adjust the following two lines on the helper REGISTERS: Sorry if i cant help more, i hardly know python and havent code for more than a decade. Tell me if more info is needed and if i can help. |
One more adjustment on the helper class get method:
from u16 to i16 |
@SergioBPereira thanks for your help! I'm a bit busy right now so I can't put much time into it but I'll take a look at your fixes.
I don't remember exactly what wait time I needed, I think I was trying to be conservative with 2. IIRC closing the connection every time makes every single request slow instead of only the first one, is your experience different?
I think it's this one that should be changed to
Oops, too much copy-pasting. I'll fix those. |
Yes, it was 2 by default.
It would allways return 0 bytes on responding to the second call, resulting in the fallback you coded of closing and reopening. So in practive was taking even more time than just closing and reopening each time. As i could reduce the wait from 2 seconds to 1 and get away with it, i use this as a quick temporary fix to get things going. I also disabled some of the attributes i dont need so it gets a liittle faster at updating than would otherwise.
you should be probably right ofc, i dindt check the API Reference to check. It's a positive number so the conversion is :) and the attribute gets its state literal. Again thanks for the help and awesome integration, i've learned a lot trying to help about how sensors work etc. Ill keep my costum version until you have the time to implement the fixes, happy both ways. I'll keep an eye out for when you commit any update and help to test it. Regards, |
Dear @SergioBPereira, |
Hi,
First thanks for the work you made available, great stuff and very helpful on my HA setup.
I do have a battery attached to the inverter and would like to have its values on the add-on. I've checked the Interface Definitions and the relevant modbus registries seem to be:
56 [Energy storage unit 1] Running status
57 [Energy storage unit 1] Charge and discharge power
58 [Energy storage unit 1] Current-day charge capacity
59 [Energy storage unit 1] Current-day discharge capacity
85 to 96 seem to not be necessary as they are more about battery specifications and configuration
Can you add those to the helper class and to the HA add-on?
Regards,
The text was updated successfully, but these errors were encountered: