arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
466 stars 104 forks source link

Thermostat accessory EQ3 radiator valve config #118

Open lulek2007 opened 5 years ago

lulek2007 commented 5 years ago

Hi,

I have been trying to set up for a few days EQ3 bluetooth radiator valve https://www.eq-3.com/products/eqiva/bluetooth-smart-radiator-thermostat.html

On my raspberry PI 0 add https://github.com/zewelor/bt-mqtt-gateway and my thermostat config in homebridge mqttthing look like

  {
    "accessory": "mqttthing",
    "type": "thermostat",
    "name": "Salon 1",
    "url": "mqtt://localhost",
    "username": "admin",
    "password": "123456",
    "topics":
    {
    "getCurrentHeatingCoolingState": {
          "topic": "thermostat/Salon_1/mode",
            "apply": "return( JSON.parse(message)  ) ;"       
        },
    "setTargetHeatingCoolingState": {
          "topic": "thermostat/Salon_1/mode/set",
            "apply": "return JSON.stringify(message);" 

        },

     "getTargetHeatingCoolingState": {
          "topic": "thermostat/Salon_1/mode",
            "apply": "return JSON.parse(message);"
        },
     "getCurrentTemperature": {
        "topic": "misensors/czujnik_TH1/temperature",
            "apply": "return JSON.parse(message);"
        },
        "getTargetTemperature": {
          "topic": "thermostat/Salon_1/target_temperature",
            "apply": "return JSON.parse(message);"
        },
        "setTargetTemperature": {
          "topic": "thermostat/Salon_1/target_temperature/set",
            "apply": "return JSON.parse(message);"
        }
    },
    "integerValue": true,
    "heatingCoolingStateValues": ["off", "on", "eco", "heat"],
    "minTemperature": 4.5,
    "maxTemperature": 30,
    "restrictHeatingCoolingState": [ 0, 1, 3 ],
    "chargingStateValues": [ "NotChargeable" ]
    }

and I have problem with parse some topics

getTargetTemperature, setTargetTemperature from EQ3 and getCurrentTemperature from external Xiaomi TH sensor work OK.

but problem is getTargetHeatingCoolingState and setTargetHeatingCoolingState

MQTT broker and EQ3 topics expect value without "" i.e.

topic from bt-mqtt-gateway look like

2019-05-20 12:07:54,322 DEBUG bt-mqtt-gw.workers_manager workers_manager.py:36:execute - Execution result of command ThermostatWorker.status_update: [{'payload': False, 'topic': 'thermostat/Salon_1/low_battery'}, {'payload': 0, 'topic': 'thermostat/Salon_1/valve_state'}, {'payload': 20.0, 'topic': 'thermostat/Salon_1/target_temperature'}, {'payload': False, 'topic': 'thermostat/Salon_1/window_open'}, {'payload': False, 'topic': 'thermostat/Salon_1/locked'}, {'payload': 'heat', 'topic': 'thermostat/Salon_1/mode'}, {'payload': 'off', 'topic': 'thermostat/Salon_1/away'}, {'payload': False, 'topic': 'thermostat/Salon_2/low_battery'}, {'payload': 0, 'topic': 'thermostat/Salon_2/valve_state'}, {'payload': 17.0, 'topic': 'thermostat/Salon_2/target_temperature'}, {'payload': False, 'topic': 'thermostat/Salon_2/window_open'}, {'payload': False, 'topic': 'thermostat/Salon_2/locked'}, {'payload': 'manual', 'topic': 'thermostat/Salon_2/mode'}, {'payload': 'off', 'topic': 'thermostat/Salon_2/away'}]

and

 mosquitto_sub -u admin -P 123456 -h 127.0.0.1  -t thermostat/Salon_1/#

look like

False
0
20.0
False
False
heat
off

unfortunately mqttthing send value like "heat" not heat

if I try send value from mosquito

mosquitto_pub -u admin -P 123456 -h 127.0.0.1  -t thermostat/Salon_1/mode/set -m heat

EQ3 valve set value correctly

Can you tell me how to set it correctly topics

setTargetHeatingCoolingState extract "" from value

and

getCurrentTemperature add "" to value

lulek2007 commented 5 years ago

Ups,

Correct EQ3 Thermostatic Valve config

 {
    "accessory": "mqttthing",
    "type": "thermostat",
    "name": "Salon 1",
    "url": "mqtt://localhost",
    "username": "admin",
    "password": "123456",
    "topics":
    {
    "getCurrentHeatingCoolingState": "thermostat/Salon_1/mode",
    "setTargetHeatingCoolingState":  "thermostat/Salon_1/mode/set",
     "getTargetHeatingCoolingState": "thermostat/Salon_1/mode",

     "getCurrentTemperature": {
        "topic": "misensors/czujnik_TH1/temperature",
            "apply": "return JSON.parse(message);"
        },
      "getTargetTemperature": "thermostat/Salon_1/target_temperature",
      "setTargetTemperature": "thermostat/Salon_1/target_temperature/set",

      "getStatusLowBattery":  "thermostat/Salon_1/low_battery"

    },
    "heatingCoolingStateValues": ["off", "on", "eco", "heat"],
    "minTemperature": 5.0,
    "maxTemperature": 29.5,
    "restrictHeatingCoolingState": [ 0, 1, 3 ],
    "startPub": {
        "thermostat/Salon_1/mode": "",
        "thermostat/Salon_1/mode/set": "",
        "thermostat/Salon_1/target_temperature": "",
        "thermostat/Salon_1/target_temperature/set": ""
        },
    "logMqtt": true
    }

only unresolved problem is topic "getStatusLowBattery": "thermostat/Salon_1/low_battery"

value is False or in poor battery True

but in Setting in Home app is Zrzut ekranu 2019-05-20 o 17 17 56

where "Poziom baterii" is english Battery level and "Ładowanie" is Charging

this is incorrect. I have RF 3 state door sensor and config for mqttthing is

{
    "accessory": "mqttthing",
    "type": "contactSensor",
    "name": "Okno 3 salon",
    "url": "mqtt://192.168.4.10",
    "username": "admin",
    "password": "123456",
    "caption": "192.168.4.13",
    "topics":
    {
        "getContactSensorState": {
            "topic": "tele/sonoff_rf1/RESULT",
            "apply": "return( ( JSON.parse(message).RfReceived.Data == '4299EE' ) ? 1 : null || ( JSON.parse(message).RfReceived.Data == '4299E7' ) ? 0  : null);"
            },
        "getStatusTampered": {
            "topic": "tele/sonoff_rf1/RESULT",
            "apply": "return( ( JSON.parse(message).RfReceived.Data == '4299EB' ) ? 1 : null );"
            },
        "getStatusLowBattery": {
            "topic": "tele/sonoff_rf1/RESULT",
            "apply": "return( ( JSON.parse(message).RfReceived.Data == '4299E9' ) ? 1 : null );"
            }
    },
        "integerValue": true,
            "logMqtt": false
    },

and settings look like Zrzut ekranu 2019-05-20 o 17 25 58

but icon and information in low battery level look like

51478740-9beae400-1d8c-11e9-829b-306e78b4a050 51478745-a0170180-1d8c-11e9-8042-3df0638c8259

Regards Lulek2007

robrec commented 5 years ago

also interested. i use bt-mqtt and eq3 too. looking forward to get help here

jat80 commented 4 years ago

@lulek2007 thanks for your config using the Sonoff RF Bridge. The link you provided for your door/window contact sensors is not working on aliexpress. Are you able to provide a new updated link so I can look at the type of sensor you used or a make and model. Many thanks!