Open lmaertin opened 1 year ago
Great tx. I've been advised by another user of the same issue :) I'll fix it in 2023.8.0-beta2.
Can you share the result of command GET 511 ?
https://github.com/Superkikim/mh-maxsmart-powerstation/blob/master/cmd-511.md
Thanks for your engagement in this improvement... here is an examplary output auf the 511 cmd
{"response":511,"code":200,"data":{"watt":[106258,2927,0,0,0,6186],"amp":[475,0,0,140,0,58],"switch":[1,1,0,1,0,1]}}
Damn these guys are stupid. They are providing milliwatts but they kept the label watt ! Seriously.
I was thinking on how I can differentiate except on firmware version. Because I don't know the fw version that exists for the different OEM providers of this product.
Maxsmart has ver 1.30 (local metadata) and 2.11 (cloud metadata). I see yours is Revogi with 3.x (cloud).
Right now, the only check I make is on version 1.30. If not version 1.30, then I set watt from milliwatt and I set generic port names.
Publishing right now on dev. Will be done in a minute.
yes, the code quality is as bad as the security of this devices...
amp = Ampere? This is also nonsense with these numbers...
Please try the 2023.8.0-beta2 version published on dev branch.
Ports are identified and translation works as well, but the POWER entities are gone now...
File "/config/custom_components/maxsmart/sensor.py", line 87 if self._device_version =! "1.30": ^ SyntaxError: invalid syntax
I think this is the root cause
yes it is... typo in the not equals... with "!=" all works fine...
yes it is... typo in the not equals... with "!=" all works fine...
Stupid mistake :laughing:
Fixed with latest commit, retagged with same version
By the way @lmaertin, looking at this, I wondered:
{"response":511,"code":200,"data":{"watt":[106258,2927,0,0,0,6186],"amp":[475,0,0,140,0,58],"switch":[1,1,0,1,0,1]}}
looking at this, is this right ? you have a device on slot 1 consuming at over 1000W ?
it's 106 Watts...
I found another bug in the division by 1000 in the dev branch. Please adapt the code as follows:
def update(self, now=None):
_LOGGER.debug("Entering update")
power_data = self._maxsmart_device.get_power_data(self._port_id)
_LOGGER.debug("power_data has been populated with %s",power_data)
if power_data is not None:
# Check if the device version is 1.30 and convert from milliwatts to watts if true
_LOGGER.debug("Firmware version is %s",self._device_version)
self._power_data = float(power_data['watt'])
if self._device_version != "1.30":
self._power_data /= 1000.0
else:
self._power_data = 0
Thank you for your support Lukas. I did it the wrong way. trying to make calculation on a string.
Anyway, it should be fixed. I have updated tag and release to the same version for now.
Please redownload from HACS. Please enable "Show beta versions". I have published it as pre-release this time to be consistent.
Works! Thank you so much
Works! Thank you so much
Hey Lukas. Still have the REVOGI strips ? Could you share the raw answer from the udp call ? I'm currently refactoring the module (https://github.com/Superkikim/maxsmart) and trying to find a way to decide automatically if it should calculate the watts from milliwatts in that module rather than in the integration.
I see two leads:
Second, I'm not a fan, because I wonder if an outlet could potentially provide 0.5W for example in some occasions.
The Revogi Strip provides the consumption in Milliwatts. Here /config/custom_components/maxsmart/sensor.py has to be adapted. My quickfix:
self._power_data = float(power_data['watt']/1000.0)
It seems sensor.py needs a switch case for the product variant.