YinHangCode / homebridge-mi-airpurifier

XiaoMi air purifier plugins for HomeBridge.
115 stars 34 forks source link

Error: The requested platform 'MiAirPurifierPlatform' was not registered by any plugin. #11

Open Chiunownow opened 6 years ago

Chiunownow commented 6 years ago

直接运行homebridge的话可以正常运行,使用systemctl start homebridge运行则报错,报错内容如下

Apr 22 22:25:06 orangepizero homebridge[6410]: Error: The requested platform 'MiAirPurifierPlatform' was not registered by any plugin.
Apr 22 22:25:06 orangepizero homebridge[6410]:     at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:122:13)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:294:45)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:85:36)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Module._compile (module.js:571:32)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Object.Module._extensions..js (module.js:580:10)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Module.load (module.js:488:32)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at tryModuleLoad (module.js:447:12)
Apr 22 22:25:06 orangepizero homebridge[6410]:     at Function.Module._load (module.js:439:3)

homebridge.service 内容如下

[Unit]
Description=HomeBridge
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

config.json 内容如下

                {
                        "platform": "MiAirPurifierPlatform",
                        "deviceCfgs": [{
                                "type": "MiAirPurifier2",
                                "ip": "myip",
                                "token": "mytoken",
                                "airPurifierDisable": false,
                                "airPurifierName": "MiAirPurifier2",
                                "silentModeSwitchDisable": false,
                                "silentModeSwitchName": "MiAirPurifier2 Silent Mode Switch",
                                "temperatureDisable": false,
                                "temperatureName": "MiAirPurifier2 Temperature",
                                "humidityDisable": false,
                                "humidityName": "MiAirPurifier2 Humidity",
                                "buzzerSwitchDisable": true,
                                "buzzerSwitchName": "MiAirPurifier2 Buzzer Switch",
                                "ledBulbDisable": true,
                                "ledBulbName": "MiAirPurifier2 LED Switch",
                                "airQualityDisable": false,
                                "airQualityName": "MiAirPurifier2 AirQuality"
}]
                }
Hinchukardt commented 5 years ago

Hi,

I had the same issue. The solution is you (and me) used the wrong install command. The install code for this is: sudo npm install -g homebridge-mi-airpurifier

This worked for me, hope it helps you