krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
443 stars 47 forks source link

Can't use local MQTT broker #413

Closed lechercheur123 closed 7 months ago

lechercheur123 commented 7 months ago

Version of the custom_component : 5.0.3

Configuration


{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.3.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Paris",
    "os_name": "Linux",
    "os_version": "6.6.20-haos",
    "supervisor": "2024.03.0",
    "host_os": "Home Assistant OS 12.1",
    "docker_version": "24.0.7",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "sunspec": {
      "version": "0.0.25",
      "requirements": [
        "pysunspec2==1.0.8"
      ]
    },
    "gtfs2": {
      "version": "0.3.0",
      "requirements": [
        "pygtfs==0.1.9",
        "gtfs-realtime-bindings==1.0.0",
        "protobuf==4.25.1"
      ]
    },
    "meross_lan": {
      "version": "5.0.3",
      "requirements": []
    },
    "hacs": {
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "meross_lan",
    "name": "Meross LAN",
    "after_dependencies": [
      "mqtt",
      "dhcp",
      "recorder",
      "persistent_notification"
    ],
    "codeowners": [
      "@krahabb"
    ],
    "config_flow": true,
    "dhcp": [
      {
        "hostname": "*",
        "macaddress": "48E1E9*"
      },
      {
        "hostname": "*",
        "macaddress": "34298F1*"
      },
      {
        "registered_devices": true
      }
    ],
    "documentation": "https://github.com/krahabb/meross_lan",
    "integration_type": "hub",
    "iot_class": "local_polling",
    "issue_tracker": "https://github.com/krahabb/meross_lan/issues",
    "loggers": [
      "custom_components.meross_lan"
    ],
    "mqtt": [
      "/appliance/+/publish"
    ],
    "requirements": [],
    "version": "5.0.3",
    "is_built_in": false
  },
  "data": {
    "host": "########0",
    "payload": {
      "all": {
        "system": {
          "hardware": {
            "type": "mss315",
            "subType": "fr",
            "version": "9.0.0",
            "chipType": "rtl8720cm",
            "uuid": "###############################0",
            "macAddress": "################0"
          },
          "firmware": {
            "version": "9.5.31",
            "compileTime": "2023/09/06-17:24:40",
            "encrypt": 1,
            "wifiMac": "################0",
            "innerIp": "########0",
            "server": "####################1",
            "port": "@1",
            "userId": "@1"
          },
          "time": {
            "timestamp": 1710888334,
            "timezone": "Europe/Paris",
            "timeRule": [
              [
                1698541200,
                3600,
                0
              ],
              [
                1711846800,
                7200,
                1
              ],
              [
                1729990800,
                3600,
                0
              ],
              [
                1743296400,
                7200,
                1
              ],
              [
                1761440400,
                3600,
                0
              ],
              [
                1774746000,
                7200,
                1
              ],
              [
                1792890000,
                3600,
                0
              ],
              [
                1806195600,
                7200,
                1
              ],
              [
                1824944400,
                3600,
                0
              ],
              [
                1837645200,
                7200,
                1
              ],
              [
                1856394000,
                3600,
                0
              ],
              [
                1869094800,
                7200,
                1
              ],
              [
                1887843600,
                3600,
                0
              ],
              [
                1901149200,
                7200,
                1
              ],
              [
                1919293200,
                3600,
                0
              ],
              [
                1932598800,
                7200,
                1
              ],
              [
                1950742800,
                3600,
                0
              ],
              [
                1964048400,
                7200,
                1
              ],
              [
                1982797200,
                3600,
                0
              ],
              [
                1995498000,
                7200,
                1
              ]
            ]
          },
          "online": {
            "status": 0,
            "bindId": "TiNgHGPmdXY7nRPd",
            "who": 1
          }
        },
        "digest": {
          "togglex": [
            {
              "channel": 0,
              "onoff": 0,
              "lmTime": 1710881065
            }
          ]
        }
      },
      "payloadVersion": 1,
      "ability": {
        "Appliance.Config.Key": {},
        "Appliance.Config.WifiList": {},
        "Appliance.Config.Wifi": {},
        "Appliance.Config.WifiX": {},
        "Appliance.Config.Trace": {},
        "Appliance.Config.Info": {},
        "Appliance.Config.OverTemp": {},
        "Appliance.System.All": {},
        "Appliance.System.Hardware": {},
        "Appliance.System.Firmware": {},
        "Appliance.System.Debug": {},
        "Appliance.System.Online": {},
        "Appliance.System.Time": {},
        "Appliance.System.Clock": {},
        "Appliance.System.Ability": {},
        "Appliance.System.Runtime": {},
        "Appliance.System.Report": {},
        "Appliance.System.Position": {},
        "Appliance.System.DNDMode": {},
        "Appliance.Control.Multiple": {
          "maxCmdNum": 3
        },
        "Appliance.Control.Bind": {},
        "Appliance.Control.Unbind": {},
        "Appliance.Control.Upgrade": {},
        "Appliance.Control.OverTemp": {},
        "Appliance.Control.ConsumptionX": {},
        "Appliance.Control.ConsumptionH": {},
        "Appliance.Control.Electricity": {},
        "Appliance.Control.ConsumptionConfig": {},
        "Appliance.Control.ToggleX": {},
        "Appliance.Control.TimerX": {
          "sunOffsetSupport": 1
        },
        "Appliance.Control.TriggerX": {},
        "Appliance.Digest.TriggerX": {},
        "Appliance.Digest.TimerX": {}
      }
    },
    "key": "#######0",
    "device_id": "###############################0",
    "device": {
      "class": "ToggleXMixinMerossDevice",
      "conf_protocol": "auto",
      "pref_protocol": "http",
      "curr_protocol": "http",
      "MQTT": {
        "cloud_profile": false,
        "locally_active": false,
        "mqtt_connection": true,
        "mqtt_connected": false,
        "mqtt_publish": false,
        "mqtt_active": false
      },
      "HTTP": {
        "http": true,
        "http_active": true
      },
      "polling_period": 30,
      "polling_strategies": {
        "Appliance.System.All": 1710888612.4391353,
        "Appliance.Config.OverTemp": 1710888612.4391353,
        "Appliance.Control.ConsumptionX": 1710888582.0440772,
        "Appliance.Control.Electricity": 1710888612.4391353,
        "Appliance.System.DNDMode": 1710888612.4391353,
        "Appliance.System.Runtime": 1710888336.2954552,
        "Appliance.System.Debug": 0
      },
      "device_response_size_min": 2510,
      "device_response_size_max": 5000
    },
    "trace": [
      [
        "time",
        "rxtx",
        "protocol",
        "method",
        "namespace",
        "data"
      ],
      [
        "2024/03/19 - 23:50:23",
        "",
        "auto",
        "GETACK",
        "Appliance.System.All",
        {
          "system": {
            "hardware": {
              "type": "mss315",
              "subType": "fr",
              "version": "9.0.0",
              "chipType": "rtl8720cm",
              "uuid": "###############################0",
              "macAddress": "################0"
            },
            "firmware": {
              "version": "9.5.31",
              "compileTime": "2023/09/06-17:24:40",
              "encrypt": 1,
              "wifiMac": "################0",
              "innerIp": "########0",
              "server": "####################1",
              "port": "@1",
              "userId": "@1"
            },
            "time": {
              "timestamp": 1710888612,
              "timezone": "Europe/Paris",
              "timeRule": [
                [
                  1698541200,
                  3600,
                  0
                ],
                [
                  1711846800,
                  7200,
                  1
                ],
                [
                  1729990800,
                  3600,
                  0
                ],
                [
                  1743296400,
                  7200,
                  1
                ],
                [
                  1761440400,
                  3600,
                  0
                ],
                [
                  1774746000,
                  7200,
                  1
                ],
                [
                  1792890000,
                  3600,
                  0
                ],
                [
                  1806195600,
                  7200,
                  1
                ],
                [
                  1824944400,
                  3600,
                  0
                ],
                [
                  1837645200,
                  7200,
                  1
                ],
                [
                  1856394000,
                  3600,
                  0
                ],
                [
                  1869094800,
                  7200,
                  1
                ],
                [
                  1887843600,
                  3600,
                  0
                ],
                [
                  1901149200,
                  7200,
                  1
                ],
                [
                  1919293200,
                  3600,
                  0
                ],
                [
                  1932598800,
                  7200,
                  1
                ],
                [
                  1950742800,
                  3600,
                  0
                ],
                [
                  1964048400,
                  7200,
                  1
                ],
                [
                  1982797200,
                  3600,
                  0
                ],
                [
                  1995498000,
                  7200,
                  1
                ]
              ]
            },
            "online": {
              "status": 0,
              "bindId": "TiNgHGPmdXY7nRPd",
              "who": 1
            }
          },
          "digest": {
            "togglex": [
              {
                "channel": 0,
                "onoff": 0,
                "lmTime": 1710881065
              }
            ]
          }
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "",
        "auto",
        "GETACK",
        "Appliance.System.Ability",
        {
          "Appliance.Config.Key": {},
          "Appliance.Config.WifiList": {},
          "Appliance.Config.Wifi": {},
          "Appliance.Config.WifiX": {},
          "Appliance.Config.Trace": {},
          "Appliance.Config.Info": {},
          "Appliance.Config.OverTemp": {},
          "Appliance.System.All": {},
          "Appliance.System.Hardware": {},
          "Appliance.System.Firmware": {},
          "Appliance.System.Debug": {},
          "Appliance.System.Online": {},
          "Appliance.System.Time": {},
          "Appliance.System.Clock": {},
          "Appliance.System.Ability": {},
          "Appliance.System.Runtime": {},
          "Appliance.System.Report": {},
          "Appliance.System.Position": {},
          "Appliance.System.DNDMode": {},
          "Appliance.Control.Multiple": {
            "maxCmdNum": 3
          },
          "Appliance.Control.Bind": {},
          "Appliance.Control.Unbind": {},
          "Appliance.Control.Upgrade": {},
          "Appliance.Control.OverTemp": {},
          "Appliance.Control.ConsumptionX": {},
          "Appliance.Control.ConsumptionH": {},
          "Appliance.Control.Electricity": {},
          "Appliance.Control.ConsumptionConfig": {},
          "Appliance.Control.ToggleX": {},
          "Appliance.Control.TimerX": {
            "sunOffsetSupport": 1
          },
          "Appliance.Control.TriggerX": {},
          "Appliance.Digest.TriggerX": {},
          "Appliance.Digest.TimerX": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "TX",
        "http",
        "GET",
        "Appliance.Config.Info",
        {
          "info": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "RX",
        "http",
        "GETACK",
        "Appliance.Config.Info",
        {
          "info": {
            "matter": {}
          }
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "TX",
        "http",
        "GET",
        "Appliance.Config.OverTemp",
        {
          "overTemp": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "RX",
        "http",
        "GETACK",
        "Appliance.Config.OverTemp",
        {
          "overTemp": {
            "enable": 1,
            "type": 1
          }
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "TX",
        "http",
        "GET",
        "Appliance.System.Debug",
        {
          "debug": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "RX",
        "http",
        "GETACK",
        "Appliance.System.Debug",
        {
          "debug": {
            "system": {
              "version": "9.5.31",
              "sysUpTime": "2h53m6s",
              "UTC": 1710888623,
              "localTimeOffset": 3600,
              "localTime": "Tue Mar 19 23:50:23 2024",
              "suncalc": "7:4;19:10",
              "memTotal": 4206464,
              "memFree": 3906168,
              "memMini": 3883296
            },
            "network": {
              "linkStatus": "connected",
              "snr": 35,
              "channel": 1,
              "signal": 100,
              "rssi": -44,
              "ssid": "########0",
              "gatewayMac": "################0",
              "innerIp": "########0",
              "wifiDisconnectCount": 0,
              "wifiDisconnectDetail": {
                "totalCount": 0,
                "detials": []
              }
            },
            "cloud": {
              "linkStatus": "connecting",
              "activeServer": "####################1",
              "mainServer": "####################1",
              "mainPort": "@1",
              "secondServer": "#2",
              "secondPort": "@0",
              "userId": "@1",
              "sysConnectTime": "Tue Mar 19 19:57:57 2024",
              "sysOnlineTime": "2h52m26s",
              "sysDisconnectCount": 0,
              "iotDisconnectDetail": {
                "totalCount": 0,
                "detials": []
              }
            }
          }
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "TX",
        "http",
        "GET",
        "Appliance.System.Runtime",
        {
          "runtime": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "RX",
        "http",
        "GETACK",
        "Appliance.System.Runtime",
        {
          "runtime": {
            "signal": 100
          }
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "TX",
        "http",
        "GET",
        "Appliance.Control.OverTemp",
        {
          "overTemp": {}
        }
      ],
      [
        "2024/03/19 - 23:50:23",
        "",
        "auto",
        "LOG",
        "debug",
        "HTTP ERROR GET Appliance.Control.OverTemp (messageId:cb915480cd944c1d94ea5b3a6060bb04 ServerDisconnectedError:Server disconnected attempt:0)"
      ],
      [
        "2024/03/19 - 23:50:24",
        "TX",
        "http",
        "PUSH",
        "Appliance.Control.OverTemp",
        {}
      ],
      [
        "2024/03/19 - 23:50:24",
        "",
        "auto",
        "LOG",
        "debug",
        "HTTP ERROR PUSH Appliance.Control.OverTemp (messageId:8b776d6e174d45dea635b5007130a01a ServerDisconnectedError:Server disconnected attempt:0)"
      ],
      [
        "2024/03/19 - 23:50:24",
        "TX",
        "http",
        "GET",
        "Appliance.Control.ConsumptionX",
        {
          "consumptionx": []
        }
      ],
      [
        "2024/03/19 - 23:50:24",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.ConsumptionX",
        {
          "consumptionx": [
            {
              "date": "2024-03-19",
              "time": 1710888458,
              "value": 0
            }
          ]
        }
      ],
      [
        "2024/03/19 - 23:50:24",
        "TX",
        "http",
        "GET",
        "Appliance.Control.ConsumptionH",
        {
          "consumptionH": {}
        }
      ],
      [
        "2024/03/19 - 23:50:24",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.ConsumptionH",
        {
          "consumptionH": []
        }
      ],
      [
        "2024/03/19 - 23:50:24",
        "",
        "auto",
        "LOG",
        "debug",
        "Handler undefined for method:GETACK namespace:Appliance.Control.ConsumptionH payload:{'consumptionH': []}"
      ],
      [
        "2024/03/19 - 23:50:24",
        "TX",
        "http",
        "GET",
        "Appliance.Control.ConsumptionH",
        {
          "consumptionH": [
            {
              "channel": 0
            }
          ]
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.ConsumptionH",
        {
          "consumptionH": [
            {
              "data": [
                {
                  "timestamp": 1710805613,
                  "value": 0
                },
                {
                  "timestamp": 1710881858,
                  "value": 0
                },
                {
                  "timestamp": 1710885458,
                  "value": 0
                },
                {
                  "timestamp": 1710888458,
                  "value": 0
                }
              ],
              "channel": 0,
              "total": 0
            }
          ]
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "",
        "auto",
        "LOG",
        "debug",
        "Handler undefined for method:GETACK namespace:Appliance.Control.ConsumptionH payload:{'consumptionH': [{'data': [{'timestamp': 1710805613, 'value': 0}, {'timestamp': 1710881858, 'value': 0}, {'timestamp': 1710885458, 'value': 0}, {'timestamp': 1710888458, 'value': 0}], 'channel': 0, 'total': 0}]}"
      ],
      [
        "2024/03/19 - 23:50:25",
        "TX",
        "http",
        "GET",
        "Appliance.Control.Electricity",
        {
          "electricity": {}
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.Electricity",
        {
          "electricity": {
            "channel": 0,
            "current": 0,
            "voltage": 2350,
            "power": 0,
            "config": {
              "voltageRatio": 188,
              "electricityRatio": 96,
              "maxElectricityCurrent": 17000,
              "powerRatio": 0
            }
          }
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "TX",
        "http",
        "GET",
        "Appliance.Control.ConsumptionConfig",
        {
          "consumptionConfig": {}
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.ConsumptionConfig",
        {
          "config": {
            "voltageRatio": 188,
            "electricityRatio": 96,
            "maxElectricityCurrent": 17000,
            "powerRatio": 0
          }
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "TX",
        "http",
        "GET",
        "Appliance.Control.ToggleX",
        {
          "togglex": []
        }
      ],
      [
        "2024/03/19 - 23:50:25",
        "RX",
        "http",
        "GETACK",
        "Appliance.Control.ToggleX",
        {
          "channel": 4294967295,
          "togglex": [
            {
              "channel": 0,
              "onoff": 0,
              "lmTime": 1710881065
            }
          ]
        }
      ]
    ]
  }
}

Describe the bug

I have several Meross plug connected to a local MQTT broker (MSS310 and MSS315), and I was using a custom python script to interact with them befure using Meross_lan.

I use a Mosquitto MQTT broker outside of my Home Assistant VM (because it was there before I started using HA), and I installed the Mosquitto official add-on my Home Assistant. I set up a bridge between both brokers.

I added a MSS315 plug to meross_lan, and it is working fine over HTTP. But if I switch to MQTT only, I have this error : No MQTT broker (either Meross cloud or HA local broker) available to connect

Capture

I don't understand this error message. Does it means that Meross_lan can reach the local HA MQTT broker ? What did I miss ?

lechercheur123 commented 7 months ago

I managed to fix this, by deleting my mqtt integration previously connected to my old MQTT broker, and reinstall it. It proposed my to automaticaly connect to the HA Mosquitto MQTT broker, and it fixed everything.