metbosch / homebridge-http-temperature

HomeBridge HomeKit Plugin for HTTP temperature endpoints
https://www.npmjs.com/package/homebridge-http-temperature
Apache License 2.0
33 stars 18 forks source link

Invalid value received #11

Closed noisyscott closed 6 years ago

noisyscott commented 6 years ago

I am able to get a bare temperature value out of my Autelis Poolcontrol by visiting an URL, however I cannot seem to get the HttpAccessory to use that data without errors. Any insight would be very helpful.

Here's my config "accessory": "HttpTemperature", "name": "Pool Temperature", "url": "http://192.168.1.201/status/pooltemp", "field_name": "", "auth": { "user": "user", "pass": "pass" } } That URL outputs 73 (although there is a trailing space at the end of the output...)

And here's the error [Pool Temperature] Error processing received information: Unexpected token [Pool Temperature] Error processing received information: Invalid value received

metbosch commented 6 years ago

I did some changes to figure what's going wrong. They are in the develop branch of this repo.

Do you know how to temporally use the develop branch in your setup? You only have to replace the index.js file of your npm installation by the index.js of the develop branch. I didn't try the code but I expect it to work.

Please, attach here the new error log.

noisyscott commented 6 years ago

Thanks!

I installed the develop branch and am now getting the following error:

Error processing received information: Received value is not a number: “NaN"

On Oct 16, 2017, at 4:39 AM, metbosch notifications@github.com wrote:

I did some changes to figure what's going wrong. They are in the develop branch of this repo.

Do you know how to temporally use the develop branch in your setup? You only have to replace the index.js file of your npm installation by the index.js https://github.com/metbosch/homebridge-http-temperature/blob/develop/index.js of the develop branch. I didn't try the code but I expect it to work.

Please, attach here the new error log.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/metbosch/homebridge-http-temperature/issues/11#issuecomment-336792285, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHjTYv9p1oxCp64nbG4yU4XuNm78ecQks5ssvfDgaJpZM4P3e_J.

metbosch commented 6 years ago

Hi @noisyscott , I think that now it is fixed. Sorry, I didn't test at all the plugin :( Let me know if you have further problems or if it works now.

noisyscott commented 6 years ago

Thanks again!

Updated to the latest development branch via the command:

npm install -g https://github.com/metbosch/homebridge-http-temperature.git#develop

Got the following output "Error processing received information: Received value is not a number: "NaN" ("undefined”)”

Manually opening the URL defined in the config gives me the following output: "50 "

There is definitely a space character at the end of the output. Maybe I should also reach out to Autelis (the maker of this specific device) and ask them to remove it.

On Oct 17, 2017, at 1:56 AM, metbosch notifications@github.com wrote:

Hi @noisyscott https://github.com/noisyscott , I think that now it is fixed. Sorry, I didn't test at all the plugin :( Let me know if you have further problems or if it works now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metbosch/homebridge-http-temperature/issues/11#issuecomment-337136075, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHjTdu97eHnO6Ok_62GDzPilDTLIYHSks5stE-igaJpZM4P3e_J.

metbosch commented 6 years ago

Hi, The space at the end is not the problem. I will try to create a simple HTTP server that returns "50 " and debug it by myself. Hopefully, I will have some time tomorrow and upload the fix. Thanks for the info!

metbosch commented 6 years ago

Hi @noisyscott , I'm not able to reproduce the error. My config.json is:

{
    "bridge": {
        "name": "HomebridgePI",
        "username": "CD:22:3D:E3:CE:30",
        "port": 51820,
        "pin": "031-45-156"
    },

    "description": "The Onion!",

    "platforms": [],

    "accessories": [
        {
            "accessory": "HttpTemperature",
            "name": "Outside Temperature",
            "url": "http://192.168.1.146:8000/test",
            "http_method": "GET",
            "field_name": " "
        }
    ]
}

And the server is returning what you said: "50 "

I modified the error message to contain the response body which is being parsed. Could you try again and put the new log here? Also, I realized that your error happens if the field_name field in the config.json contains a space char or some hidden character. Could you also check it?

noisyscott commented 6 years ago

Apologies, I had an old config that contained some characters inside the “field_name”. After ensuring that the field_name was blank made everything work! Thank you for your great support.

However (totally new issue now) it looks like my thermometer only reports in Fahrenheit, so my pool is reading as 154 degrees right now! I have been searching around and there’s no current facility for my device it to report in Celsius. Autelis have been asked to update their firmware to support both Celsius and Fahrenheit, but it’s pretty much falling on deaf ears.

I can kind of fake the correct display of temperature by changing “Settings>General>Language & Region on my phone to use Celsius, but I am not sure what other issues this will cause me down the line.

On Oct 18, 2017, at 11:25 AM, metbosch notifications@github.com wrote:

Hi @noisyscott https://github.com/noisyscott , I'm not able to reproduce the error. My config.json is:

{ "bridge": { "name": "HomebridgePI", "username": "CD:22:3D:E3:CE:30", "port": 51820, "pin": "031-45-156" },

"description": "The Onion!",

"platforms": [],

"accessories": [
    {
        "accessory": "HttpTemperature",
        "name": "Outside Temperature",
        "url": "http://192.168.1.146:8000/test",
        "http_method": "GET",
        "field_name": " "
    }
]

} And the server is returning what you said: "50 "

I modified the error message to contain the response body which is being parsed. Could you try again and put the new log here? Also, I realized that your error happens if the field_name field in the config.json contains a space char or some hidden character. Could you also check it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metbosch/homebridge-http-temperature/issues/11#issuecomment-337647856, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHjTa6WjJ03J_-sTVoke4RuHN2ISl6oks5stiZngaJpZM4P3e_J.

metbosch commented 6 years ago

@noisyscott Are you using the develop branch, right? I will merge the small fix into master and publish it to npm.

metbosch commented 6 years ago

@noisyscott About the units problem, You mean that you have different units in different accessories endpoints. In addition, ios considers all temperature values with the same units. Consequently, you purpose some mechanism in the plug-in to translate the received value into another units?

noisyscott commented 6 years ago

Yes, I am using the develop branch.

On Oct 18, 2017, at 4:06 PM, metbosch notifications@github.com wrote:

@noisyscott https://github.com/noisyscott Are you using the develop branch, right? I will merge the small fix into master and publish it to npm.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metbosch/homebridge-http-temperature/issues/11#issuecomment-337727874, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHjTR6B8wQGddKtbDsotMg1P3EeVxa4ks5stmhdgaJpZM4P3e_J.

noisyscott commented 6 years ago

Not sure I understand the question.

I believe the core issue is that HomeKit expects all values to be Celsius unless informed that this specific device is actually reporting Fahrenheit — otherwise HomeKit via iOS locale settings will dutifully convert the values from Celsius to Fahrenheit. There’s a bit of discussion re: this issue in the main homebridge page

https://github.com/nfarina/homebridge/issues/71 https://github.com/nfarina/homebridge/issues/71

On Oct 18, 2017, at 4:08 PM, metbosch notifications@github.com wrote:

@noisyscott https://github.com/noisyscott About the units problem, You mean that you have different units in different accessories endpoints. In addition, ios considers all temperature values with the same units. Consequently, you purpose some mechanism in the plug-in to translate the received value into another units?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/metbosch/homebridge-http-temperature/issues/11#issuecomment-337728397, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHjTd1fPfZAVuNBg8rVXqR_pIJIGrFzks5stmjagaJpZM4P3e_J.

metbosch commented 6 years ago

Closing the issue and following the "celsius <-> fahrenheit" discussion in #15