i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

Adding trait TemperatureControl to sensor device #101

Closed glsf91 closed 3 years ago

glsf91 commented 3 years ago

Can you add the TemperatureControl trait to the sensor device? From the google documentation:

Sensors may also use other traits covering data they can report, such as:
HumiditySetting
TemperatureControl
OpenClose
Brightness

This can be used if you have a temperature sensor. I can add this to the googleDevices.json but then the GUI is not working anymore if I click on this device in the GUI. I don't know if it is possible but maybe make it possible to add every trait to a device is more flexible. Or if I can add a "custom" (not in the listbox now) trait I want by typing in the (full) trait name.

i8beef commented 3 years ago

I think the right answer here is to remove the trait validation piece altogether actually. Google has asserted that you can assign any trait to any device type even if it doesn't make sense, so that's probably just a little questionable at this point.

Google was nice enough to put out a repo (https://github.com/actions-on-google/smart-home-schema) that documents their contract requirements in a way that I could actually use to generate a reliable validation framework (its already a little unmanageable in that area, Google changes things without notification, and being able to regen it would be a major boon). I have it on my todo list to look at how I might be able to do that.

I also need to get a release together soon anyway for some other features, so I might just consider dropping the validation here for now, and then reimplement later.

i8beef commented 3 years ago

I removed the limitation for now of what Traits can be assigned to what DeviceTypes.

glsf91 commented 3 years ago

This is working fine now. Thanks.