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

getName returns "undefined" value #20

Open
gdavids57 opened this issue Apr 20, 2020 · 2 comments
Open

getName returns "undefined" value #20

gdavids57 opened this issue Apr 20, 2020 · 2 comments

Comments

@gdavids57
Copy link

The plug-in was working fine and then started throwing a getName error as indicated in Error after I activated an Hesperus automation using the output from the plug-in. I deactivated the automation but the problem persisted. As you can see in the accessory configuration, "name" is defined. I tried configuring a getter URL, "getName" to no avail.

Error
[4/20/2020, 4:22:17 PM] [Pool Level Sensor] getName getter function returned with data: undefined
[4/20/2020, 4:22:17 PM] [Pool Level Sensor] updating Name with value
[4/20/2020, 4:22:17 PM] TypeError: Cannot read property 'url' of undefined
at HttpAdvancedAccessory. (/usr/lib/node_modules/homebridge-http-advanced-accessory/index.js:208:68)
at HttpAdvancedAccessory.getter (/usr/lib/node_modules/homebridge-http-advanced-accessory/index.js:371:7)
at Characteristic.Name.emit (events.js:311:20)
at Characteristic.Name.Characteristic.getValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:164:10)
at Bridge. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:771:20)
at Array.forEach ()
at Bridge.Accessory._handleGetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:735:8)
at HAPServer.emit (events.js:311:20)
at HAPServer._handleCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:928:10)
at HAPServer. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:209:39)

Accessory Configuration
"accessories": [
{
"accessory": "HttpAdvancedAccessory",
"service": "ContactSensor",
"name": "Pool Level Sensor",
"polling": false,
"forceRefreshDelay": 0,
"debug": true,
"urls": {
"getContactSensorState": {
"url": "http://192.168.1.143/cmd?params=1",
"mappers": [
{
"type": "jpath",
"parameters": {
"jpath": "$.return_value"
}
}
]
},
"getName": {
"url": "http://192.168.1.143/",
"mappers": [
{
"type": "jpath",
"parameters": {
"jpath": "$.name"
}
}
]
}
}
}
]

@staromeste
Copy link
Owner

staromeste commented Apr 21, 2020 via email

@gdavids57
Copy link
Author

I set the forceRefreshDelay to five and debug and polling to false. I also left the getName emitter in the configuration. Now the plug-in works. I'm still not certain why I need to configure a getName emitter when the plug-in already has a "name" attribute.

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

2 participants