jtebbens / com.homewizard

Homewizard app for Homey
9 stars 7 forks source link

Issue adding 1-phase kWh meter #64

Closed HuiPri closed 2 years ago

HuiPri commented 2 years ago

When I want to add my 1-phase kWh meter to Homey it shows me 3 meters, I have only 1. After adding all 3 they show the same numbers as the 3 energy sockets I already added. So I think the wrong device type is shown in the add-dialog? The same 3 are show also when I select to add a 3-phase kWh meter, which I do not have. Same issue here too?

jtebbens commented 2 years ago

You pick what you have. It will show possible options. Don't really know how else to limit it.

HuiPri commented 2 years ago

Sorry, it does not work.

In HomeWizzard Energy iOS app I have the following:

1 X P1 meter

3 x Energy Sockets

1 x 1-phase kWh meter

The P1 meter and the 3 Energy Sockets are already successfully added to Homey, no issues.

But when I want to add the 1-phase kWh meter it shows me 3 items, all with the description ‘kwh meter (1-phase)’, I would expect a single item in the list.

When I add all three, the data that is displayed in the icon is the same as the data for the 3 Energy sockets, not the data from 1-phase kWh meter.

The same also happens when I add a 3-phase kWh meter (which I don’t have): it show me 3 items, all with the description ‘kwh meter (3-phase)’ , I would expect an empty list (cancelled the add-process).

The same also happens when I add another P1-meter (I have only 1): it again shows me 3 items, all with the description ‘Energy (P1-dongle)’ , I would expect an empty list (cancelled the add-process).

But when I want to add another Energy Socket, the list is empty, as it should.

It looks like in the cases above, the list always shows the 3 Energy Sockets with an adjusted name instead of the correct single one.

Please have a look into this issue.

From: jtebbens @.> Sent: zondag 16 januari 2022 16:03 To: jtebbens/com.homewizard @.> Cc: HuiPri @.>; Author @.> Subject: Re: [jtebbens/com.homewizard] Issue adding 1-phase kWh meter (Issue #64)

You pick what you have. It will show possible options. Don't really know how else to limit it.

— Reply to this email directly, view it on GitHub https://github.com/jtebbens/com.homewizard/issues/64#issuecomment-1013891896 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACS4DA4S33DQY3BIK774OGLUWLMZZANCNFSM5MC3KV5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ACS4DAZNKB6NIZE3XAKAPJ3UWLMZZA5CNFSM5MC3KV5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHRXMGOA.gif Message ID: @. @.> >

jtebbens commented 2 years ago

I think this is more of a Homey Discovery issue rather and application problem. Reason is that in the code I check for the mdns results and match on 3 items but that seems not to be reflected back properly. In the mdns browser the 1phase device matches SDM230-wifi, API needs to be enabled = 1 and "host" should be ^kwhmeter-

See my code in app.json. Funny enough this seems not to flow back to the app properly. I only have 1 dongle and one socket so can't replicate atm.

"SDM230": {
  "type": "mdns-sd",
  "mdns-sd": {
    "name": "hwenergy",
    "protocol": "tcp"
  },
  "id": "{{txt.serial}}",
  "conditions": [
    [
      {
        "field": "txt.product_type",
        "match": {
          "type": "string",
          "value": "SDM230-wifi"
        }
      },
      {
        "field": "txt.api_enabled",
        "match": {
          "type": "string",
          "value": "1"
        }
      },
      {
        "field": "host",
        "match": {
          "type": "regex",
          "value": "^kwhmeter-"
        }
      }
    ]
  ]
}