i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

Support for Thermostats? #67

Closed diabl0w closed 4 years ago

diabl0w commented 4 years ago

I am unsure if its a config issue or an issue with homeautio, but after setting up a thermostat, google responds "that mode isn't available for the House Thermostat" whenever I ask it to change the temperature or if I ask it to set to heat or cool mode.

"family/home/thermostat": { "id": "family/home/thermostat", "type": "action.devices.types.THERMOSTAT", "disabled": false, "willReportState": false, "roomHint": "Home", "name": { "defaultNames": [], "name": "Thermostat", "nicknames": ["House Temperature", "House Temp", "AC"] }, "deviceInfo": { "manufacturer": "Beca", "model": "BHP-6000", "hwVersion": "1.0", "swVersion": "1.0" }, "traits": [ { "trait": "action.devices.traits.TemperatureSetting", "attributes": { "availableThermostatModes": "off,heat,cool,auto", "thermostatTemperatureUnit": "F" }, "commands": { "action.devices.commands.ThermostatTemperatureSetpoint": { "thermostatTemperatureSetpoint": "family/home/thermostat/cmnd/temperature" }, "action.devices.commands.ThermostatSetMode": { "thermostatMode": "family/home/thermostat/cmnd/mode" } }, "state": { "thermostatMode": { "topic": "family/home/thermostat/stat/mode", "googleType": "string", "valueMap": null }, "thermostatTemperatureSetpoint": { "topic": "family/home/thermostat/stat/temperature", "googleType": "numeric", "valueMap": null }, "thermostatTemperatureAmbient": { "topic": "family/home/thermostat/tele/temperature", "googleType": "numeric", "valueMap": null } }
} ], "customData": null },

diabl0w commented 4 years ago

I made two changes to my config:

1) changed available modes to have "heatcool" instead of "auto" because that was the proper setting for my use case 2) added the "commandOnlyTemperatureSetting: true" attribute

One of those two things fixed it, I am assuming the second one

As always, thanks for this great program!

i8beef commented 4 years ago

Did you get any validation errors in the log? heatcool should really only drive some of the validation for allowing Range setting...

Right now there's not a way to get a SYNC request directly without hitting the endpoints yourself. Im working on a version right now that DOES have that capability, so that we can see what Google sees in these cases. Their rules are a little challenging at times and their documentation tends to have holes around special cases once in a while, so I'm wondering if you've stumbled on something about the voice command that isn't well documented.

Setting commandOnly might suck if you ever want to ask Google Home what your current settings are.

If you play around and find anything out, definitely let me know. Like I said, I'm currently working on some changes, upgrades, and adding in all the new traits, etc. they just added, and some of it centers around validation, Google response generation, and command param to state mapping, so if there's tweaks that are needed here, nows a great time to get em out there.

diabl0w commented 4 years ago

No errors in the log, just info saying that the command was received. I am not sure what "no way to get SYNC without hitting endpoints yourself" means haha, a lot of this is over my head :). I am guessing it has to do with the sync requests and the GoogleGraph API? I am not sure how much I can troubleshoot it without being guided through it all, so not sure if its worth it to you.

For commandOnly mode, yeah I understand. But for now I am okay, I don't even have the GoogleGraph or willreportstate things enabled anyway. At some point in the future I will implement that.

Like I said, it was definitely one of those two changes that fixed it.

Side note: Another weird thing that happens is if I set "thermostatTemperatureUnit" attribute to F and ask to set 75 degrees, the payload google sends is 23. If i set "thermostatTemperatureUnit" attribute to C and ask to set 75 degrees, they payload is properly 75. So it seems this is backwards, not sure if that is on Google's end or what. For what its worth, I am in a North American (Farenheit) region, I am not sure if that is taken into account on the Google side, but it still doesn't make sense as to why its behaving this way.

i8beef commented 4 years ago

Google Home has an "intent" called "SYNC" that they send to basically bootstrap their understanding of your devices. In this case, something saying "Google don't know about this" is a good indicator of "the SYNC didn't look right", and the easiest way to troubleshoot is to take the SYNC response that was sent to Google and examine / run it through their validator. Right now there's no easy way for you to do that, but there will be in the next version.

ReportState was once optional but Google has been moving it toward "required" for a while now, just FYI.

The C vs F isn't backwards, Google just makes everything more complicated than it needs to be... in this case ALL commands are in Celcius, but it will ACCEPT things in Fahrenheit and then convert it behind the scenes... but for some ungodly reason they don't give you the same courtesy when they actually send the values to YOU. I.e, you're saying "Set it to 75 degrees F" and they are sending ""23 degrees C". When you set it to C and say the same thing, no conversion takes place, so its sending the value as specified.

Actually, that's a good request, can you make another ticket for that? I can actually do the conversion on my side if I have all the right device information to make the determination to make sure you get the value in the units you specify. Just another "Fix Google's stupid decisions" features 😄

diabl0w commented 4 years ago

Google Home has an "intent" called "SYNC" that they send to basically bootstrap their understanding of your devices. In this case, something saying "Google don't know about this" is a good indicator of "the SYNC didn't look right", and the easiest way to troubleshoot is to take the SYNC response that was sent to Google and examine / run it through their validator. Right now there's no easy way for you to do that, but there will be in the next version.

ReportState was once optional but Google has been moving it toward "required" for a while now, just FYI.

The C vs F isn't backwards, Google just makes everything more complicated than it needs to be... in this case ALL commands are in Celcius, but it will ACCEPT things in Fahrenheit and then convert it behind the scenes... but for some ungodly reason they don't give you the same courtesy when they actually send the values to YOU. I.e, you're saying "Set it to 75 degrees F" and they are sending ""23 degrees C". When you set it to C and say the same thing, no conversion takes place, so its sending the value as specified.

Actually, that's a good request, can you make another ticket for that? I can actually do the conversion on my side if I have all the right device information to make the determination to make sure you get the value in the units you specify. Just another "Fix Google's stupid decisions" features

Thanks for the detailed explanation! I just confirmed that it is the "commandonlytemperaturesetting" that causes the issue... by default, without setting it, is set to false. I would guess maybe when syncing and validating, it sees that it is set for two way communication (according to docs "the controller can confirm the new device state after sending the request"), but my willreportstate is off, so then google just refuses to mess with it.