PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

Barometer device published as an electrical cost device HomeKit device #152

Closed lboue closed 4 years ago

lboue commented 6 years ago

Hello,

I have a Barometer sensor working in Domoticz but published as an electrical cost device HomeKit device via homebridge. img_9212

Here is the domoticz-devices-list: domoticz-devices-list

Here is what the Domoticz API returns:

pi@raspberrypi:~$ curl "http://192.168.1.91:8080/json.htm?type=devices&rid=174"
{
   "ActTime" : 1522860913,
   "AstrTwilightEnd" : "22:25",
   "AstrTwilightStart" : "05:46",
   "CivTwilightEnd" : "21:07",
   "CivTwilightStart" : "07:04",
   "DayLength" : "13:01",
   "NautTwilightEnd" : "21:45",
   "NautTwilightStart" : "06:26",
   "ServerTime" : "2018-04-04 18:55:13",
   "SunAtSouth" : "14:05",
   "Sunrise" : "07:35",
   "Sunset" : "20:36",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "Barometer" : 990.20000000000005,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "990.2 hPa",
         "Description" : "",
         "Favorite" : 1,
         "Forecast" : 9,
         "ForecastStr" : "Unknown",
         "HardwareID" : 15,
         "HardwareName" : "Zigate",
         "HardwareType" : "Zigate plugin",
         "HardwareTypeVal" : 94,
         "HaveTimeout" : false,
         "ID" : "e324",
         "LastUpdate" : "2018-04-04 18:48:25",
         "Name" : "Zigate - Baro - e324",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Barometer",
         "Timers" : "false",
         "Type" : "General",
         "TypeImg" : "gauge",
         "Unit" : 8,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "174"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

Can I help you to fix that?

Regards, Ludovic

lboue commented 6 years ago

I think I find why I have this behavior. Here is the default case in the domoticz_accessory.js file:

                        } else {
                            var service = this.getService(eDomoticzServices.MeterDeviceService);
                            var dMeterDeviceCharacteristic = this.getCharacteristic(service, eDomoticzServices.CurrentConsumption);
                            var val10 = Helper.cleanFloat(message.svalue1);
                            callback(dMeterDeviceCharacteristic, val10);
                            break;
                        }
                    }

The following case is missing (subType == "Barometer"):

            case this.Type == "General" || this.Type == "YouLess Meter" || this.Type == "Current" || this.Type == "UV" || this.Type == "Usage" || this.Type == "Lux":
                {
                   ...
                         } else if (this.subType == "Barometer") {
                            ...
                            break;
                        }

Can someone help me to fix that?

Best Regards, Ludovic

PatchworkBoy commented 4 years ago

Should be fixed now... test and report back / reopen issue.

Remove .homebridge/accessories/cachedAccessories, update to v2.1.24 & restart.