yasuoza / homebridge-echonet-lite-heater-cooler

Homebridge plugin for ECHONET lite air conditioner.
MIT License
2 stars 0 forks source link

Failed to addDeviceToAccessory #34

Closed mcackay closed 2 years ago

mcackay commented 2 years ago

Hi - I stumbled across your project today, and though I'd give it a go -- as the other homebridge plugin for EchonetLite i was trying seems to be a bit unstable, and impact performance of homebridge.

I installed it manually in the Homebridge terminal using the npm command and restarted. And am seeing ...

[HeaterCooler] Failed to addDeviceToAccessory - address: 192.168.1.24 [HeaterCooler] Failed to addDeviceToAccessory - address: 192.168.1.27

... in the logs, and the IPs corresponds to my two Mitsubishi Heatpumps that i've enabled the Echonet protocol for.

Is there anything I can do to support the project, and help get these devices recognised in Homebridge? Are there some debug logs/etc that would be useful to diagnose this?


Sorry - i wasn't logged in when starting the bug report, so this reporting template didn't show up:

Describe The Bug: Mitsubishi Heatpump AirConditioners (with Wifi Adapter) not being discovered.

To Reproduce: Installed plugin, restarted Homebridge.

Expected behavior: Was hoping the Aircon units would show up under Homebridge Accessories list.

Logs:

[2/25/2022, 10:15:19 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[2/25/2022, 10:15:19 PM] [HB Supervisor] Started Homebridge v1.4.0 with PID: 2406
[2/25/2022, 10:15:20 PM] Loaded config.json with 0 accessories and 6 platforms.
[2/25/2022, 10:15:20 PM] Loaded 9 cached accessories from cachedAccessories.
[2/25/2022, 10:15:20 PM] ---
[2/25/2022, 10:15:21 PM] Disabled plugin: homebridge-echonet-lite-eolia@0.3.0
[2/25/2022, 10:15:21 PM] ---
[2/25/2022, 10:15:21 PM] Loaded plugin: homebridge-mitsubishi-au-nz@0.0.6
[2/25/2022, 10:15:21 PM] Registering platform 'homebridge-mitsubishi-au-nz.MitsubishiAirconAUNZ'
[2/25/2022, 10:15:21 PM] ---
[2/25/2022, 10:15:22 PM] Loaded plugin: homebridge-ring@9.24.0
[2/25/2022, 10:15:22 PM] Registering platform 'homebridge-ring.Ring'
[2/25/2022, 10:15:22 PM] ---
[2/25/2022, 10:15:22 PM] Loaded plugin: homebridge-shelly@0.19.1
[2/25/2022, 10:15:22 PM] Registering platform 'homebridge-shelly.Shelly'
[2/25/2022, 10:15:22 PM] ---
[2/25/2022, 10:15:22 PM] Loaded plugin: homebridge-config-ui-x@4.42.0
[2/25/2022, 10:15:22 PM] Registering platform 'homebridge-config-ui-x.config'
[2/25/2022, 10:15:22 PM] ---
[2/25/2022, 10:15:23 PM] Loaded plugin: homebridge-echonet-lite-heater-cooler@0.1.0
[2/25/2022, 10:15:23 PM] Registering platform 'homebridge-echonet-lite-heater-cooler.EchonetLiteHeaterCooler'
[2/25/2022, 10:15:23 PM] ---
[2/25/2022, 10:15:23 PM] Loading 6 platforms...
[2/25/2022, 10:15:23 PM] [Config] Initializing config platform...
[2/25/2022, 10:15:23 PM] [Config] Running in Service Mode
[2/25/2022, 10:15:23 PM] [Shelly] Initializing Shelly platform...
[2/25/2022, 10:15:23 PM] [Ring] Initializing Ring platform...
[2/25/2022, 10:15:23 PM] [MitsubishiAirconAUNZ] Initializing MitsubishiAirconAUNZ platform...
[2/25/2022, 10:15:23 PM] [MitsubishiAirconAUNZ] Failed to read settings: Error: ENOENT: no such file or directory, open '/homebridge/persist/MitsubishiAirconAUNZ.json'
[2/25/2022, 10:15:23 PM] Ignoring config for the platform "EoliaPlatform" in your config.json as the plugin "homebridge-echonet-lite-eolia" has been disabled.
[2/25/2022, 10:15:23 PM] [HeaterCooler] Initializing EchonetLiteHeaterCooler platform...
[2/25/2022, 10:15:23 PM] [Ring] Configuring cached accessory xxx-xx-xx-xxx-xxx Front Door
[2/25/2022, 10:15:23 PM] [Ring] Configuring cached accessory xxx-xx-xxx-xxx-xxx Auckland Mode
[2/25/2022, 10:15:23 PM] [Shelly] 4 accessories loaded from cache
Setup Payload:
X-HM://XXXXXXX
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 111-22-333 │     
    └────────────┘     

[2/25/2022, 10:15:23 PM] [HeaterCooler] Waiting for 10 seconds to start discovering ECHONET Lite devices...
[2/25/2022, 10:15:23 PM] Homebridge v1.4.0 (HAP v0.10.0) (Homebridge 1BFC) is running on port 51324.
[2/25/2022, 10:15:23 PM] [Shelly] Admin server is running on port 8181
[2/25/2022, 10:15:24 PM] [homebridge-mitsubishi-au-nz] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected valid finite number and received "undefined" (undefined). See https://git.io/JtMGR for more info.
[2/25/2022, 10:15:24 PM] [homebridge-mitsubishi-au-nz] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected valid finite number and received "undefined" (undefined). See https://git.io/JtMGR for more info.
[2/25/2022, 10:15:26 PM] [Ring] Found the following locations:
[2/25/2022, 10:15:26 PM] [Ring]   locationId: 9dae16e9-bcbf-4ee9-7d9c-87612c5cab18 - Auckland
[2/25/2022, 10:15:27 PM] [Ring] Configuring 1 cameras and 2 devices for location "Auckland" - locationId: xxx-xx-xx-xx-xxxxx
[2/25/2022, 10:15:33 PM] [HeaterCooler] Failed to addDeviceToAccessory - address: 192.168.1.24
[2/25/2022, 10:15:33 PM] [HeaterCooler] Failed to addDeviceToAccessory - address: 192.168.1.27
[2/25/2022, 10:16:03 PM] [HeaterCooler] Finished discovering ECHONET Lite devices
[2/25/2022, 10:16:34 PM] [homebridge-mitsubishi-au-nz] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected valid finite number and received "undefined" (undefined). See https://git.io/JtMGR for more info.
[2/25/2022, 10:16:34 PM] [homebridge-mitsubishi-au-nz] This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected valid finite number and received "undefined" (undefined). See https://git.io/JtMGR for more info.

Plugin Config:

{
    "bridge": {
        "name": "Homebridge 1BDD",
        "username": "AA:BB:CC:DD:EE:FF",
        "port": 51324,
        "pin": "111-22-333"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "Shelly",
            "admin": {
                "enabled": true
            },
            "networkInterface": "192.168.1.xx",
            "devices": [
                {
                    "id": "xxxxxXXXXX",
                    "name": "Shelly H&T",
                    "exclude": true
                },
                {
                    "id": "60AAABBB545",
                    "name": "Motion Sensor"
                }
            ],
            "platform": "Shelly"
        },
        {
            "refreshToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "hideLightGroups": true,
            "hideCameraSirenSwitch": true,
            "hideAlarmSirenSwitch": true,
            "hideUnsupportedServices": true,
            "sendDoorbellMotionNotificationsToTv": false,
            "platform": "Ring"
        },
        {
            "platform": "MitsubishiAirconAUNZ",
            "name": "MitsubishiAirconAUNZ",
            "user": "xxx",
            "pass": "xxx"
        },
        {
            "name": "Echonet Lite Eolia",
            "platform": "EoliaPlatform",
            "_bridge": {
                "username": "AA:BB:CC:DD:EE:FF",
                "port": 59702
            }
        },
        {
            "name": "HeaterCooler",
            "refreshInterval": 1,
            "requestTimeout": 10,
            "platform": "EchonetLiteHeaterCooler"
        }
    ],
    "disabledPlugins": [
        "homebridge-echonet-lite",
        "homebridge-echonet-lite-eolia"
    ]
}

Screenshots:

Environment:

yasuoza commented 2 years ago

Some properties expected by this plugin are not published by your heater cooler.

Try

  1. Stop homebridge.
  2. Put following script at this plugin directory. (maybe at node_modules/homebridge-echonet-lite-heater-cooler).
  3. run node script.js 192.168.1.24
  4. Copy output and paste to new comment.

Thank you.

script.js ```js const util = require('util'); const EchonetLite = require('node-echonet-lite'); const args = process.argv.slice(2); const IP = args[0]; if (!IP) { console.error("Usage: node script.js IP"); process.exit(2); } const EOJ = [1, 48, 1]; const el = new EchonetLite({type: 'lan'}); el.getPropertyMapsAsync = util.promisify(el.getPropertyMaps).bind(el); function getPropertyName(epc) { const group_code = EOJ[0]; const class_code = EOJ[1]; return el.getPropertyName(group_code, class_code, epc); } async function getPropertyMaps(ip) { const maps = await el.getPropertyMapsAsync(ip, EOJ); return { inf: maps['message']['data']['inf'].sort().map(epc => { return { epc: `0x${Number(epc).toString(16).toUpperCase()}`, desc: `${getPropertyName(epc)}` }; }), set: maps['message']['data']['set'].sort().map(epc => { return { epc: `0x${Number(epc).toString(16).toUpperCase()}`, desc: `${getPropertyName(epc)}` }; }), get: maps['message']['data']['get'].sort().map(epc => { return { epc: `0x${Number(epc).toString(16).toUpperCase()}`, desc: `${getPropertyName(epc)}` }; }), } } el.init(async (err) => { try { if (err) { console.error(err); process.exit(1); } const maps = await getPropertyMaps(IP); console.dir(maps); } finally { el.close(); } }); ```
mcackay commented 2 years ago

Thanks Yasuharu -

Here's the script output. I have a Mitsubishi Air Conditioning unit, connected with a MAC-568IF-E Wi-Fi interface adapter.

{
  inf: [
    { epc: '0x80', desc: 'Operation status' },
    { epc: '0x81', desc: 'Installation location' },
    { epc: '0x88', desc: 'Fault status' },
    { epc: '0x8F', desc: 'Operation power-saving' },
    { epc: '0xA0', desc: 'Air flow rate setting' },
    { epc: '0xB0', desc: 'Operation mode setting' }
  ],
  set: [
    { epc: '0x80', desc: 'Operation status' },
    { epc: '0x81', desc: 'Installation location' },
    { epc: '0x8F', desc: 'Operation power-saving' },
    { epc: '0xA0', desc: 'Air flow rate setting' },
    {
      epc: '0xA1',
      desc: 'Automatic control of air flow direction setting'
    },
    { epc: '0xA3', desc: 'Automatic swing of air flow setting' },
    { epc: '0xA4', desc: 'Air flow direction (vertical) setting' },
    { epc: '0xB0', desc: 'Operation mode setting' },
    { epc: '0xB3', desc: 'Set temperature value' }
  ],
  get: [
    { epc: '0x80', desc: 'Operation status' },
    { epc: '0x81', desc: 'Installation location' },
    { epc: '0x82', desc: 'Standard version information' },
    { epc: '0x83', desc: 'Identification number' },
    { epc: '0x86', desc: 'Manufacturer’s fault code' },
    { epc: '0x88', desc: 'Fault status' },
    { epc: '0x89', desc: 'Fault description' },
    { epc: '0x8A', desc: 'Manufacturer code' },
    { epc: '0x8F', desc: 'Operation power-saving' },
    { epc: '0x9D', desc: 'Status change announcement property map' },
    { epc: '0x9E', desc: 'Set property map' },
    { epc: '0x9F', desc: 'Get property map' },
    { epc: '0xA0', desc: 'Air flow rate setting' },
    {
      epc: '0xA1',
      desc: 'Automatic control of air flow direction setting'
    },
    { epc: '0xA3', desc: 'Automatic swing of air flow setting' },
    { epc: '0xA4', desc: 'Air flow direction (vertical) setting' },
    { epc: '0xB0', desc: 'Operation mode setting' },
    { epc: '0xB3', desc: 'Set temperature value' },
    { epc: '0xBB', desc: 'Measured value of room temperature' },
    { epc: '0xBE', desc: 'Measured outdoor air temperature' }
  ]
}

I wasn't sure how to enable debug logging in homebridge -- but made a minor code change temporarily to platform.js, to log the caught error:

[2/26/2022, 10:30:57 PM] [HeaterCooler] Failed to addDeviceToAccessory - address: 192.168.1.24
[2/26/2022, 10:30:57 PM] [HeaterCooler] TypeError: Cannot read property 'code' of null
yasuoza commented 2 years ago

Thank you for your report. ae584e701036342de0b3a8347e1b939ab67834ed1 may be a fix.

Pls clean install homebridge-echonet-lite-heater-cooler by

  1. Delete node_modules/homebridge-echonet-lite-heater-cooler
  2. Run npm update homebridge-echonet-lite-heater-cooler

Thank you.

mcackay commented 2 years ago

Bingo! That seems to have done the trick. I now have visibility of my aircon units in Homebridge and the Home app. Thanks!

Let me know if you need any further debug information or testing done.

yasuoza commented 2 years ago

Grad to hear that! Thank you for your log info, it made easier to fix the issue.