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

Compatibility with Homebridge 2.0 #681

Open
noelhibbard opened this issue Aug 14, 2024 · 2 comments
Open

Compatibility with Homebridge 2.0 #681

noelhibbard opened this issue Aug 14, 2024 · 2 comments

Comments

@noelhibbard
Copy link

I just switched to 2.0-beta.11 and now I'm getting this error in the log:

TypeError: Service.BatteryService is not a constructor
    at configToServices (/homebridge/node_modules/homebridge-mqttthing/index.js:3545:34)
    at createServices (/homebridge/node_modules/homebridge-mqttthing/index.js:3568:24)
    at new makeThing (/homebridge/node_modules/homebridge-mqttthing/index.js:3600:23)
    at /homebridge/node_modules/homebridge/src/server.ts:362:50
    at Array.forEach (<anonymous>)
    at Server.loadAccessories (/homebridge/node_modules/homebridge/src/server.ts:282:29)
    at Server.start (/homebridge/node_modules/homebridge/src/server.ts:167:12)

Here is the config for the accessory that is throwing the error:

        {
            "accessory": "mqttthing",
            "type": "contactSensor",
            "name": "Kitchen Refrigerator Door",
            "url": "mqtt://server1.example.com",
            "topics": {
                "getContactSensorState": {
                    "topic": "zigbee2mqtt/Kitchen/Fridge Door",
                    "apply": "return !JSON.parse(message).contact;"
                },
                "getStatusTampered": {
                    "topic": "zigbee2mqtt/Kitchen/Fridge Door",
                    "apply": "return JSON.parse(message).tamper;"
                },
                "getStatusLowBattery": {
                    "topic": "zigbee2mqtt/Kitchen/Fridge Door",
                    "apply": "return JSON.parse(message).battery_low;"
                },
                "getBatteryLevel": {
                    "topic": "zigbee2mqtt/Kitchen/Fridge Door",
                    "apply": "return JSON.parse(message).battery;"
                }
            }
        }

If I remove the config for getBatteryLevel, this error goes away and everything seems to work fine.

@fox34
Copy link

fox34 commented Sep 6, 2024

Context, as stated in the homebridge guide for upgrading to 2.0:

BatteryService has been removed in favour of Battery

@GithHobby
Copy link

How did you switch to the beta?
I'm using the 1.8.5 and I didn't find how to switch.

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