steilerDev / homebridge-openhab2-complete

A homebridge plugin for openHAB, that has the expectation to fully support all Services offered by Apple's Homekit Accessory Protocol (HAP)
GNU General Public License v3.0
52 stars 16 forks source link

Temperature Sensor not created when using Number:Temperature item type #8

Closed saintonotole closed 5 years ago

saintonotole commented 5 years ago

Describe the bug If i use generic item type "Number" in OH2, then everything works fine. If i use more specific "Number:Temperature" item type, HomeKit Item silently not created at all.

Expected behavior I expect plugin to correctly parse readings from number:temperature items, or, at least, throw warning in logs about wrong item type.

Configurations

Environment (please complete the following information):

steilerDev commented 5 years ago

Hi @saintonotole,

I didn't even know that you could have a Unit of Measurement inside your basic item types.

I tested your setup and found, that the log correctly shows a warning, when using Number:Temperature and does not add the accessory to the system. Unfortunately I haven't seen a way to request the 'raw' number from openHAB, instead of the number + unit.

I think so far it is expected behavior, however it is not desired behavior. Therefore I will look into it.

saintonotole commented 5 years ago

Thanks. Well, at least, you can get pair of number + unit and pattern from api, and try to parse pattern.

Request URL https://openhab.local/rest/items/Bedroom_Temp

Response Body

  "link": "https://openhab.local/rest/items/Bedroom_Temp",
  "state": "27.0 °C",
  "stateDescription": {
    "pattern": "%.1f %unit%",
    "readOnly": true,
    "options": []
  },
steilerDev commented 5 years ago

Hi @saintonotole , my latest commit on the V0.10.0 branch (382a369) should fix your problem and support UoM inside Number types. You can test it by manually installing this state or wait a bit, since I plan to release V0.10.0 very soon and use the upstream release later. Regards, Frank

steilerDev commented 5 years ago

Released with V0.10.0 and commit e8bf1246991e671ae0a872a18eac2b83a9316b62. Unless you are still experiencing problems, I will now close the issue.