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

Revogi Strip provides Milliwatts #4

Open
lmaertin opened this issue Aug 11, 2023 · 16 comments
Open

Revogi Strip provides Milliwatts #4

lmaertin opened this issue Aug 11, 2023 · 16 comments

Comments

@lmaertin
Copy link

lmaertin commented Aug 11, 2023

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.

@Superkikim
Copy link
Owner

Superkikim commented Aug 11, 2023

Great tx. I've been advised by another user of the same issue :) I'll fix it in 2023.8.0-beta2.

@Superkikim
Copy link
Owner

Can you share the result of command GET 511 ?

https://github.com/Superkikim/mh-maxsmart-powerstation/blob/master/cmd-511.md

@lmaertin
Copy link
Author

lmaertin commented Aug 11, 2023

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]}}

@Superkikim
Copy link
Owner

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.

@lmaertin
Copy link
Author

lmaertin commented Aug 11, 2023

yes, the code quality is as bad as the security of this devices...

amp = Ampere? This is also nonsense with these numbers...

@Superkikim
Copy link
Owner

Please try the 2023.8.0-beta2 version published on dev branch.

@lmaertin
Copy link
Author

Ports are identified and translation works as well, but the POWER entities are gone now...

@lmaertin
Copy link
Author

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

@lmaertin
Copy link
Author

yes it is... typo in the not equals... with "!=" all works fine...

@Superkikim
Copy link
Owner

yes it is... typo in the not equals... with "!=" all works fine...

Stupid mistake 😆

Fixed with latest commit, retagged with same version

@Superkikim
Copy link
Owner

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 ?

@lmaertin
Copy link
Author

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

@Superkikim
Copy link
Owner

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.

@lmaertin
Copy link
Author

Works! Thank you so much

@Superkikim
Copy link
Owner

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:

  1. Most accurate: "It if's REVOGI and version 3.??" (Need the version), then it's milliwatts
  2. If it's over 1000, it's milliwatts.

Second, I'm not a fan, because I wonder if an outlet could potentially provide 0.5W for example in some occasions.

@Superkikim Superkikim reopened this Sep 2, 2024
@tmtom
Copy link

tmtom commented Oct 15, 2024

Would it be possible to distinguish based on the JSON string whether it looks like float or int (whether it has decimal dot like 1.23 or not like 1230)? https://github.com/Superkikim/mh-maxsmart-powerstation/blob/master/cmd-511.md suggest Watt to be as float? Can't confirm though as my power strips reports milliwatts and milliamps.

Btw I have Revogi SOW323, FW 3.49 and Cocoso SOW323 with FW 1.06 and both use ints (miliwatts/miliamps) like:
{"response":511,"code":200,"data":{"watt":[10710,0,0,0,0,0],"amp":[102,0,0,0,0,0],"switch":[1,0,0,0,0,0]}}

The Cocoso seems to be just rebranded Revogi where for some reason they use different FW numbering (it is this one https://gzhls.at/blob/ldb/6/4/4/f/cd460345576de703ee13e6b0cd983f17beea.pdf)

I did not get what do you need to get tested but if you explain I can try.

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

No branches or pull requests

3 participants