Giter VIP home page Giter VIP logo

Comments (14)

KhaosT avatar KhaosT commented on May 29, 2024

What's the sentence you used to ask Siri adjusting the temperature?
On Sun, Dec 14, 2014 at 12:44 AM tommyd75 [email protected] wrote:

Trying to test the thermostat_accessory and it gives me an error when I
try and speak with Siri to adjust the temperature. This is what I get. I'm
using the thermostat_accessory.js file as it was originally so I haven't
modified it.

/root/HAP-NodeJS/AccessoryController.js:52
var update_char_iid = update_char["iid"];
^
TypeError: Cannot read property 'iid' of undefined
at Object.processCharacteristicsValueWrite
(/root/HAP-NodeJS/AccessoryController.js:52:36)
at Object.responseCharacteristic (/root/HAP-NodeJS/Server.js:112:29)
at IncomingMessage. (/root/HAP-NodeJS/Server.js:53:17)
at IncomingMessage.emit (events.js:95:17)
at IncomingMessage. (

stream_readable.js:764:14) at IncomingMessage.emit (events.js:92:17) at
emitReadable
(_stream_readable.js:426:10)
at emitReadable (_stream_readable.js:422:5)
at readableAddChunk (_stream_readable.js:165:9)
at IncomingMessage.Readable.push (_stream_readable.js:127:10)

If I manually go into the thermostat in the iOS app and click on the
target temp field it lets me set the target temp and it works and shows up
in the log.

Any ideas?
I tried searching but this error doesn't look like it's come up before,
maybe a syntax problem or one of my files have a typo?
Sorry to keep bothering you, I really appreciate all the help :)


Reply to this email directly or view it on GitHub
https://github.com/KhaosT/HAP-NodeJS/issues/29.

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

I've tried multiple phrases.
Set the thermostat to 25 degrees.

Set the thermostat to 25 degrees heating.

Set the thermostat in my vacation home to 25 degrees.

I called my home "vacation" in the iOS app.

Sent from my iPhone 5s 

On Dec 14, 2014, at 2:57 AM, Khaos Tian [email protected] wrote:

What's the sentence you used to ask Siri adjusting the temperature?
On Sun, Dec 14, 2014 at 12:44 AM tommyd75 [email protected] wrote:

Trying to test the thermostat_accessory and it gives me an error when I
try and speak with Siri to adjust the temperature. This is what I get. I'm
using the thermostat_accessory.js file as it was originally so I haven't
modified it.

/root/HAP-NodeJS/AccessoryController.js:52
var update_char_iid = update_char["iid"];
^
TypeError: Cannot read property 'iid' of undefined
at Object.processCharacteristicsValueWrite
(/root/HAP-NodeJS/AccessoryController.js:52:36)
at Object.responseCharacteristic (/root/HAP-NodeJS/Server.js:112:29)
at IncomingMessage. (/root/HAP-NodeJS/Server.js:53:17)
at IncomingMessage.emit (events.js:95:17)
at IncomingMessage. (

stream_readable.js:764:14) at IncomingMessage.emit (events.js:92:17) at
emitReadable
(_stream_readable.js:426:10)
at emitReadable (_stream_readable.js:422:5)
at readableAddChunk (_stream_readable.js:165:9)
at IncomingMessage.Readable.push (_stream_readable.js:127:10)

If I manually go into the thermostat in the iOS app and click on the
target temp field it lets me set the target temp and it works and shows up
in the log.

Any ideas?
I tried searching but this error doesn't look like it's come up before,
maybe a syntax problem or one of my files have a typo?
Sorry to keep bothering you, I really appreciate all the help :)


Reply to this email directly or view it on GitHub
https://github.com/KhaosT/HAP-NodeJS/issues/29.


Reply to this email directly or view it on GitHub.

from hap-nodejs.

KhaosT avatar KhaosT commented on May 29, 2024

@tommyd75 the latest commit should fix this issue.

This issue happens because Siri (at least under English) will think the unit of temperature you said is in Ferinheight but the accessory is asking for Celsius so Siri will try to convert Ferinheight to Celsius. However, after conversion, HomeKit will check the data validity before sending it to accessory which fails because 25 Fahrenheit is -3.89 Celsius. I have the lower boundary set to be 16 celsius which cause HomeKit reject to send this update request... Then a bug in HomeKit will cause sending an update command with nothing inside which causes the HAP Server crash.

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

Thanks! That did the trick it works now, but I'm wondering if there is any way to not have it use celsius and use fahrenheight directly without it trying to convert it.
I changed the value unit: "fahrenheit" but now it doesn't recognize my commands.
The output I get when I tell it to " set the thermostat to 70 degrees" is this

Enable Event: false
{ characteristics: [] }

from hap-nodejs.

KhaosT avatar KhaosT commented on May 29, 2024

@tommyd75 make sure you changed the unit, designedMinValue and designedMaxValue. After that you may need to remove the accessory from HomeKit on iOS and re-pair it.

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

This is what I have in there, but it still doesn't work. I deleted it from the IOS app and re added it.
It works when I go inside the iOS app and select "target temperature" and type in the number.

cType: types.CURRENT_TEMPERATURE_CTYPE,
onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Current Temperature", value); },
perms: ["pr","ev"],
format: "int",
initialValue: 65,
supportEvents: false,
supportBonjour: false,
manfDescription: "Current Temperature",
unit: "fahrenheit"
},{
cType: types.TARGET_TEMPERATURE_CTYPE,
onUpdate: function(value) {
target = "65";
if (value === 65) {target = "65";};
if (value === 66) {target = "66";};
if (value === 67) {target = "67";};
if (value === 68) {target = "68";};
if (value === 69) {target = "69";};
if (value === 70) {target = "70";};
if (value === 71) {target = "71";};
if (value === 72) {target = "72";};
if (value === 73) {target = "73";};
if (value === 74) {target = "74";};
if (value === 75) {target = "75";};
request("http://192.168.1.100/RunEvent=Set%20temp%20to%20"+target);
},
perms: ["pw","pr","ev"],
format: "int",
initialValue: 65,
supportEvents: false,
supportBonjour: false,
manfDescription: "Target Temperature",
designedMinValue: 65,
designedMaxValue: 75,
designedMinStep: 1,
unit: "fahrenheit"
},{ cType: types.TEMPERATURE_UNITS_CTYPE,
onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Unit", value); },
perms: ["pr","ev"],
format: "int",
initialValue: 0,
supportEvents: false,
supportBonjour: false,
manfDescription: "Unit",
}]
}]
}

from hap-nodejs.

KhaosT avatar KhaosT commented on May 29, 2024

the initial value of TEMPERATURE_UNITS_CTYPE also need to be 0.

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

Like this?
Thats what had, I left it that way.

},{ cType: types.TEMPERATURE_UNITS_CTYPE,
onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Unit", value); },
perms: ["pr","ev"],
format: "int",
initialValue: 0,
supportEvents: false,
supportBonjour: false,
manfDescription: "Unit",
}]
}]
}

from hap-nodejs.

KhaosT avatar KhaosT commented on May 29, 2024

@tommyd75 My fault, 0 means Celsius and 1 means Fahrenheit… So that one should be 1 instead of 0.

from hap-nodejs.

lkngtn avatar lkngtn commented on May 29, 2024

Im having this issue as well but I don't think this solution is working for me.

Relevant part of the thermostat accessory:

    cType: types.TARGET_TEMPERATURE_CTYPE,
    onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Target Temperature", value); },
    perms: ["pw","pr","ev"],
            format: "int",
            initialValue: 75,
            supportEvents: false,
            supportBonjour: false,
            manfDescription: "Target Temperature",
            designedMinValue: 68,
            designedMaxValue: 82,
            designedMinStep: 1,
            unit: "fahrenheit"
},{
    cType: types.TEMPERATURE_UNITS_CTYPE,
    onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Unit", value); },
    perms: ["pr","ev"],
            format: "int",
            initialValue: 1,
            supportEvents: false,
            supportBonjour: false,
            manfDescription: "Unit",
}]

}]

}

When I change the value for target temperature from the accessory screen it works, but when I try and set it using a command from siri like "Set Thermostat to 78" or "Set Thermostat to 78 degrees Fahrenheit" I get the following error:

/var/HAP-Nodejs/AccessoryController.js:52
var update_char_iid = update_char["iid"];
^
TypeError: Cannot read property 'iid' of undefined
at Object.processCharacteristicsValueWrite (/var/HAP-Nodejs/AccessoryController.js:52:36)
at Object.responseCharacteristic (/var/HAP-Nodejs/Server.js:112:29)
at IncomingMessage. (/var/HAP-Nodejs/Server.js:53:17)
at IncomingMessage.EventEmitter.emit (events.js:95:17)
at IncomingMessage. (stream_readable.js:746:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at emitReadable
(_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at IncomingMessage.Readable.push (_stream_readable.js:127:10)

I think I should have everything configured to be using fahrenheit (siri is set to US english, the unit type is set to 1, and the unit for target temp is set to fahrenheit). Anything I'm missing here?

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

The only way I was able to get it to work and respond properly with the fahrenheit commands is to have Celsius in there and Siri converts it automatically, so I can say set the thermostat to 70 degrees and she responds "setting the thermostat to 70 degrees"
My solution is a little different than yours but it works. Heres a sample of what I'm using.
I converted the values to Celsius and it took a while of trial and error but it works like this.
I'm in the US so I have my iPhone set to US English as well.

cType: types.CURRENT_TEMPERATURE_CTYPE,
    onUpdate: function(value) { console.log("Change:",value); execute("Thermostat", "Current Temperature", value); },
    perms: ["pr","ev"],
    format: "int",
    initialValue: 18.333,
    supportEvents: false,
    supportBonjour: false,
    manfDescription: "Current Temperature",
    unit: "celsius"
},{
    cType: types.TARGET_TEMPERATURE_CTYPE,
    onUpdate: function(value) { 

target = "18.333";
if (value === 18.333) {target = "65";};
if (value === 18.888) {target = "66";};
if (value === 19.443) {target = "67";};
if (value === 19.998) {target = "68";};
if (value === 20.558) {target = "69";};
if (value === 21.113) {target = "70";};
if (value === 21.668) {target = "71";};
if (value === 22.223) {target = "72";};
if (value === 22.778) {target = "73";};
if (value === 23.333) {target = "74";};
if (value === 23.888) {target = "75";};


request("http://192.168.1.100/tenHsServer/Set%20temp%20to%20"+target); },
    perms: ["pw","pr","ev"],
    format: "int",
    initialValue: 18.333,
    supportEvents: false,
    supportBonjour: false,
    manfDescription: "Target Temperature",
    designedMinValue: 18.333,
    designedMaxValue: 23.888,
    designedMinStep: 0.005,
    unit: "celsius"

from hap-nodejs.

lkngtn avatar lkngtn commented on May 29, 2024

Thanks Tommy, I was able to get this working by converting from celsius to fahrenheit manually in the onUpdate function as you suggested. Siri now sets the temperature correctly, however, this means that the temperature stored in the characteristic is in celsius which is a bit confusing when setting up action sets.

Is this a limitation of home kit or with the HAP-NodeJS server?

from hap-nodejs.

tommyd75 avatar tommyd75 commented on May 29, 2024

It seems like it's a home kit thing, but maybe things will change as they update things.
KhaosT had stated this earlier in this post.

"This issue happens because Siri (at least under English) will think the unit of temperature you said is in Ferinheight but the accessory is asking for Celsius so Siri will try to convert Ferinheight to Celsius. However, after conversion, HomeKit will check the data validity before sending it to accessory which fails because 25 Fahrenheit is -3.89 Celsius. I have the lower boundary set to be 16 celsius which cause HomeKit reject to send this update request... Then a bug in HomeKit will cause sending an update command with nothing inside which causes the HAP Server crash."

from hap-nodejs.

KhaosT avatar KhaosT commented on May 29, 2024

I tried the HomeKit Accessory Simulator and it seems that thing also uses unit in celsius even if you state Temperature Units to be fahrenheit. Since I don't have access to "HomeKit Accessory Profiles", I could only assume that the spec defines the value of temperature characteristic always to be in celsius and the developer should do the conversion manually...

from hap-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.