michbeck100 / pimatic-hap

Pimatic homekit bridge
GNU General Public License v2.0
30 stars 10 forks source link

Pimatic shell-sensor recognized and communicated to Homekit? #51

Closed pplucky closed 7 years ago

pplucky commented 7 years ago

Hello, first of all thanks for this great plugin!

I have a question: is it possible to use pimatic-hap with pimatic-shell-execute? I'm using it to obtain the temperature via js script, but HomeKit is not recognizing it as temperature sensor (even after putting the correct service name in hap tag in config). Also wanted to use it to obtain relative humidity, but I suppose issue will be the same.

Example of the config { "attributeName": "Temperature", "attributeType": "number", "attributeUnit": "ºC", "command": "node /home/pi/pimatic-app/scripts/TempQuartoDiogo2.js", "interval": 60000, "id": "temperatura-quarto-diogo", "name": "Temperatura Quarto Diogo", "class": "ShellSensor", "hap": { "service": "Thermostat" } }

Thanks and regards.

michbeck100 commented 7 years ago

Currently this is not supported. https://github.com/michbeck100/pimatic-hap/issues/42 also asked for this feature. I'll see if I can implement something. But this would require a completely different approach than with the other devices.

pplucky commented 7 years ago

Yes, I agree it is a similar request, but can't you just only include shell-sensor in case an Homekit-valid service was stated in hap tag as above?

Just thinking out loud, considering that HAP-NodeJS also supports it if well defined.

michbeck100 commented 7 years ago

No it's not that easy because the shell-execute-plugin doesn't expose any specific device types like switch, temperature sensor. It's a generic plugin that can be use as sensor, actor or something completely different. There's no way I can determine if it's running as temperature sensor, but to define some "specification" that users must comply to, like adding a temperature attribute.

michbeck100 commented 7 years ago

https://github.com/michbeck100/pimatic-hap/commit/da2c11e2ae64665c03976eb6913c88631757c35f implements a new generic sensor that currently supports temperature and humidity. Note that these attributes are case sensitive, so you would have to change your config so the attributeName is "temperature". The new sensor will be included in the next release.

pplucky commented 7 years ago

Absolutely amazing. Working perfectly after installing 0.9.0. Thanks a lot for the great work.