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

Thermostat transform state "heatingItem / collingItem" #38

Closed grzegorz914 closed 4 years ago

grzegorz914 commented 4 years ago

Hi,

I grr this error : [2019-7-31 12:30:05 PM] [openHAB2-Complete] Received state: CLOSED (transformed to Error: Unable to transform CLOSED using transformation map {"ON":1,"OFF":0}) for Ciepła woda temperatura [PLC_CwuPompaStan]

hovewer in thermostat description "Contact" items are supported. Changed Contact to Switch solved this bug.

steilerDev commented 4 years ago

Good catch, I forgot to implement the contact characteristics, will work on that.

steilerDev commented 4 years ago

This should now be fixed and will be shipped with the next release coming (hopefully) this week. You can test my latest commit on this (ea96c22) and see if I made it work.

grzegorz914 commented 4 years ago

@steilerDev tested Your latest commit and all thermostat and temp item are nor readable:

[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Pogoda temp.: Error: Not configuring numeric actor characteristic for Pogoda temp.: Required undefined for Pogoda temp. not defined: {"name":"Pogoda temp.","type":"temp","currentTempItem":"PLC_PogodaTemp","batteryItem":"","batteryItemInverted":"false","serialNumber":"6E129A70CCFF","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Piec temp.: Error: Not configuring numeric actor characteristic for Piec temp.: Required undefined for Piec temp. not defined: {"name":"Piec temp.","type":"temp","currentTempItem":"PLC_PiecTemp","batteryItem":"","batteryItemInverted":"false","serialNumber":"6DF902FBCA76","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Ciepła woda temp.: Error: Not configuring numeric actor characteristic for Ciepła woda temp.: Required undefined for Ciepła woda temp. not defined: {"name":"Ciepła woda temp.","type":"thermostat","currentTempItem":"PLC_CwuTempA","targetTempItem":"PLC_CwuTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_CwuPompaGrzanieStan","coolingItem":"CwuPompaChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"CwuTermTrybAktualnyNumer","serialNumber":"C94B6DC7080A","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Kotłownia temp.: Error: Not configuring numeric actor characteristic for Kotłownia temp.: Required undefined for Kotłownia temp. not defined: {"name":"Kotłownia temp.","type":"temp","currentTempItem":"PLC_KotlowniaTempA","batteryItem":"","batteryItemInverted":"false","serialNumber":"4FA8197DD35D","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Przedpokój mały temp.: Error: Not configuring numeric actor characteristic for Przedpokój mały temp.: Required undefined for Przedpokój mały temp. not defined: {"name":"Przedpokój mały temp.","type":"thermostat","currentTempItem":"PLC_PrzedpokojMalyTempA","targetTempItem":"PLC_PrzedpokojMalyTempZ","heatingItem":"PLC_PrzedpokojMalyZaworGrzanieStan","coolingItem":"PrzedpokojMalyZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"PrzedpokojMalyTermTrybAktualnyNumer","serialNumber":"1C8E7F7C9A0D","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Przedpokój duży temp.: Error: Not configuring numeric actor characteristic for Przedpokój duży temp.: Required undefined for Przedpokój duży temp. not defined: {"name":"Przedpokój duży temp.","type":"thermostat","currentTempItem":"PLC_PrzedpokojDuzyTempA","targetTempItem":"PLC_PrzedpokojDuzyTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_PrzedpokojDuzyZaworGrzanieStan","coolingItem":"PrzedpokojDuzyZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"PrzedpokojDuzyTermTrybAktualnyNumer","serialNumber":"FD27D12B292D","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Pokój temp.: Error: Not configuring numeric actor characteristic for Pokój temp.: Required undefined for Pokój temp. not defined: {"name":"Pokój temp.","type":"thermostat","currentTempItem":"PLC_PokojTempA","targetTempItem":"PLC_PokojTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_PokojZaworGrzanieStan","coolingItem":"PokojZaworChlodzenieStan","tempUnit":"Celsius","modeItem":"PokojTermTrybAktualnyNumer","serialNumber":"F068F35E2521","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Salon temp.: Error: Not configuring numeric actor characteristic for Salon temp.: Required undefined for Salon temp. not defined: {"name":"Salon temp.","type":"thermostat","currentTempItem":"PLC_SalonTempA","targetTempItem":"PLC_SalonTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_SalonZaworGrzanieStan","coolingItem":"SalonZaworChlodzenieStan","tempUnit":"Celsius","modeItem":"SalonTermTrybAktualnyNumer","serialNumber":"9408BE5C009D","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Jadalnia temp.: Error: Not configuring numeric actor characteristic for Jadalnia temp.: Required undefined for Jadalnia temp. not defined: {"name":"Jadalnia temp.","type":"thermostat","currentTempItem":"PLC_JadalniaTempA","targetTempItem":"PLC_JadalniaTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_JadalniaZaworGrzanieStan","coolingItem":"JadalniaZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"JadalniaTermTrybAktualnyNumer","serialNumber":"701D4D2CC3A3","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Kuchnia temp.: Error: Not configuring numeric actor characteristic for Kuchnia temp.: Required undefined for Kuchnia temp. not defined: {"name":"Kuchnia temp.","type":"thermostat","currentTempItem":"PLC_KuchniaTempA","targetTempItem":"PLC_KuchniaTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_KuchniaZaworGrzanieStan","coolingItem":"KuchniaZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"KuchniaTermTrybAktualnyNumer","serialNumber":"7AFABB8DEDAD","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Łazienka parter temp.: Error: Not configuring numeric actor characteristic for Łazienka parter temp.: Required undefined for Łazienka parter temp. not defined: {"name":"Łazienka parter temp.","type":"thermostat","currentTempItem":"PLC_LazienkaParterTempA","targetTempItem":"PLC_LazienkaParterTempZ","heatingItem":"PLC_LazienkaParterZaworGrzanieStan","coolingItem":"LazienkaParterZaworChlodzenieStan","tempUnit":"Celsius","modeItem":"LazienkaParterTermTrybAktualnyNumer","serialNumber":"D5DE0A9F3078","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Garderoba temp.: Error: Not configuring numeric actor characteristic for Garderoba temp.: Required undefined for Garderoba temp. not defined: {"name":"Garderoba temp.","type":"thermostat","currentTempItem":"PLC_GarderobaTempA","targetTempItem":"PLC_GarderobaTempZ","heatingItem":"PLC_GarderobaZaworGrzanieStan","coolingItem":"GarderobaZaworChlodzenieStan","tempUnit":"Celsius","modeItem":"GarderobaTermTrybAktualnyNumer","serialNumber":"256505DAA925","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Biuro temp.: Error: Not configuring numeric actor characteristic for Biuro temp.: Required undefined for Biuro temp. not defined: {"name":"Biuro temp.","type":"thermostat","currentTempItem":"PLC_BiuroTempA","targetTempItem":"PLC_BiuroTempZ","heatingItem":"PLC_BiuroZaworGrzanieStan","coolingItem":"BiuroZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"BiuroTermTrybAktualnyNumer","serialNumber":"E728E5D2E5CB","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Kamila temp.: Error: Not configuring numeric actor characteristic for Kamila temp.: Required undefined for Kamila temp. not defined: {"name":"Kamila temp.","type":"thermostat","currentTempItem":"PLC_KamilaTempA","targetTempItem":"PLC_KamilaTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_KamilaZaworGrzanieStan","coolingItem":"KamilaZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"KamilaTermTrybAktualnyNumer","serialNumber":"3D60235AB370","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Sypialnia temp.: Error: Not configuring numeric actor characteristic for Sypialnia temp.: Required undefined for Sypialnia temp. not defined: {"name":"Sypialnia temp.","type":"thermostat","currentTempItem":"PLC_SypialniaTempA","targetTempItem":"PLC_SypialniaTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_SypialniaZaworGrzanieStan","coolingItem":"SypialniaZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"SypialniaTermTrybAktualnyNumer","serialNumber":"109384A408AE","version":"0.10.2"}, skipping
[9/9/2019, 7:28:10 PM] [openHAB2-Complete] Unable to add accessory Łazienka piętro temp.: Error: Not configuring numeric actor characteristic for Łazienka piętro temp.: Required undefined for Łazienka piętro temp. not defined: {"name":"Łazienka piętro temp.","type":"thermostat","currentTempItem":"PLC_LazienkaPietroTempA","targetTempItem":"PLC_LazienkaPietroTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_LazienkaPietroZaworGrzanieStan","coolingItem":"LazienkaPietroZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"LazienkaPietroTermTrybAktualnyNumer","serialNumber":"B8751ECE5185","version":"0.10.2"}, skipping
steilerDev commented 4 years ago

Fixed with latest commit 53ec2b9

grzegorz914 commented 4 years ago

Sorry but this fix also not working:

[9/10/2019, 9:25:18 AM] [openHAB2-Complete] Unable to add accessory Przedpokój mały temp.: Error: Not configuring numeric sensor/actor characteristic for Przedpokój mały temp.: Required undefined for Przedpokój mały temp. not defined: {"name":"Przedpokój mały temp.","type":"thermostat","currentTempItem":"PLC_PrzedpokojMalyTempA","targetTempItem":"PLC_PrzedpokojMalyTempZ","heatingItem":"PLC_PrzedpokojMalyZaworGrzanieStan","coolingItem":"PrzedpokojMalyZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"PrzedpokojMalyTermTrybAktualnyNumer","serialNumber":"1C8E7F7C9A0D","version":"0.10.2"}, skipping
[9/10/2019, 9:25:18 AM] [openHAB2-Complete] Unable to add accessory Przedpokój duży temp.: Error: Not configuring numeric sensor/actor characteristic for Przedpokój duży temp.: Required undefined for Przedpokój duży temp. not defined: {"name":"Przedpokój duży temp.","type":"thermostat","currentTempItem":"PLC_PrzedpokojDuzyTempA","targetTempItem":"PLC_PrzedpokojDuzyTempZ","currentHumidityItem":"","targetHumidityItem":"","heatingItem":"PLC_PrzedpokojDuzyZaworGrzanieStan","coolingItem":"PrzedpokojDuzyZaworChlodzenieStan","tempUnit":"Celsius","heatingThresholdTempItem":"","coolingThresholdTempItem":"","modeItem":"PrzedpokojDuzyTermTrybAktualnyNumer","serialNumber":"FD27D12B292D","version":"0.10.2"}, skipping
grzegorz914 commented 4 years ago

Finally with commit fbe702a working OK.

grzegorz914 commented 4 years ago

It is correct that this function in Numeric.js:

function addNumericActorCharacteristic(service, characteristic, CONF_MAP, optional) {
    try {

        let [item] = this._getAndCheckItemType(CONF_MAP.item, ['Number']);

        this._log.debug(`Creating numeric actor characteristic for ${this.name} with ${item}`);

        characteristic.on('set', setState.bind(this,
            item,
            parseFloat
        ));

        this._subscribeCharacteristic(characteristic,
            item,
            parseFloat
        );
    } catch(e) {
        let msg = `Not configuring numeric actor characteristic for ${this.name}: ${e.message}`;
        service.removeCharacteristic(characteristic);
        if(optional) {
            this._log.debug(msg);
        } else {
            throw new Error(msg);
        }
    }
}

is not exported here:

module.exports = {
    addCurrentRelativeHumidityCharacteristic,
    addCurrentAmbientLightLevelCharacteristic,
    addNumericSensorCharacteristic,
    addNumericSensorActorCharacteristic,
    addNumericSensorActorCharacteristicWithTransformation,
    addAirQualityCharacteristic,
};
steilerDev commented 4 years ago

Yes, that is correct. I actually can remove the whole function (and will do so later). Thanks for your feedback!

grzegorz914 commented 4 years ago

Closed, all is fixed here.