From f71b960e2b7f557524b15edb60d22b8d35d2b828 Mon Sep 17 00:00:00 2001 From: Khole Jones Date: Tue, 4 Jan 2022 16:06:40 +0000 Subject: [PATCH] Test adding more sensors as diagnostic and configuration --- pyhiveapi/apyhiveapi/helper/const.py | 60 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/pyhiveapi/apyhiveapi/helper/const.py b/pyhiveapi/apyhiveapi/helper/const.py index ea0283d..96f8212 100644 --- a/pyhiveapi/apyhiveapi/helper/const.py +++ b/pyhiveapi/apyhiveapi/helper/const.py @@ -70,6 +70,7 @@ "Mode": 'self.session.attr.getMode(device["hiveID"])', "Availability": "self.online(device)", "Connectivity": "self.online(device)", + "Power": "self.session.switch.getPowerUsage(device)" } PRODUCTS = { @@ -80,46 +81,47 @@ ], "heating": [ 'addList("climate", p, temperatureunit=self.data["user"]["temperatureUnit"])', - 'addList("switch", p, haName=" Heat on Demand", hiveType="Heating_Heat_On_Demand")', - 'addList("sensor", p, haName=" Current Temperature", hiveType="Heating_Current_Temperature", custom=True)', - 'addList("sensor", p, haName=" Target Temperature", hiveType="Heating_Target_Temperature", custom=True)', - 'addList("sensor", p, haName=" State", hiveType="Heating_State", custom=True)', - 'addList("sensor", p, haName=" Mode", hiveType="Heating_Mode", custom=True)', - 'addList("sensor", p, haName=" Boost", hiveType="Heating_Boost", custom=True)', + 'addList("switch", p, haName=" Heat on Demand", hiveType="Heating_Heat_On_Demand", category="config")', + 'addList("sensor", p, haName=" Current Temperature", hiveType="Heating_Current_Temperature", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Target Temperature", hiveType="Heating_Target_Temperature", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" State", hiveType="Heating_State", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Mode", hiveType="Heating_Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Boost", hiveType="Heating_Boost", category="diagnostic", custom=False)', ], "trvcontrol": [ 'addList("climate", p, temperatureunit=self.data["user"]["temperatureUnit"])', - 'addList("sensor", p, haName=" Current Temperature", hiveType="Heating_Current_Temperature", custom=True)', - 'addList("sensor", p, haName=" Target Temperature", hiveType="Heating_Target_Temperature", custom=True)', - 'addList("sensor", p, haName=" State", hiveType="Heating_State", custom=True)', - 'addList("sensor", p, haName=" Mode", hiveType="Heating_Mode", custom=True)', - 'addList("sensor", p, haName=" Boost", hiveType="Heating_Boost", custom=True)', + 'addList("sensor", p, haName=" Current Temperature", hiveType="Heating_Current_Temperature", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Target Temperature", hiveType="Heating_Target_Temperature", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" State", hiveType="Heating_State", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Mode", hiveType="Heating_Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Boost", hiveType="Heating_Boost", category="diagnostic", custom=False)', ], "hotwater": [ 'addList("water_heater", p,)', - 'addList("sensor", p, haName="Hotwater State", hiveType="Hotwater_State", custom=True)', - 'addList("sensor", p, haName="Hotwater Mode", hiveType="Hotwater_Mode", custom=True)', - 'addList("sensor", p, haName="Hotwater Boost", hiveType="Hotwater_Boost", custom=True)', + 'addList("sensor", p, haName="Hotwater State", hiveType="Hotwater_State", category="diagnostic", custom=False)', + 'addList("sensor", p, haName="Hotwater Mode", hiveType="Hotwater_Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName="Hotwater Boost", hiveType="Hotwater_Boost", category="diagnostic", custom=False)', ], "activeplug": [ 'addList("switch", p)', - 'addList("sensor", p, haName=" Mode", hiveType="Mode", custom=True)', - 'addList("sensor", p, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", p, haName=" Mode", hiveType="Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Power", hiveType="Power", category="diagnostic", custom=False)', ], "warmwhitelight": [ 'addList("light", p)', - 'addList("sensor", p, haName=" Mode", hiveType="Mode", custom=True)', - 'addList("sensor", p, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", p, haName=" Mode", hiveType="Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], "tuneablelight": [ 'addList("light", p)', - 'addList("sensor", p, haName=" Mode", hiveType="Mode", custom=True)', - 'addList("sensor", p, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", p, haName=" Mode", hiveType="Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], "colourtuneablelight": [ 'addList("light", p)', - 'addList("sensor", p, haName=" Mode", hiveType="Mode", custom=True)', - 'addList("sensor", p, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", p, haName=" Mode", hiveType="Mode", category="diagnostic", custom=False)', + 'addList("sensor", p, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], "motionsensor": ['addList("binary_sensor", p)'], "contactsensor": ['addList("binary_sensor", p)'], @@ -127,27 +129,27 @@ DEVICES = { "contactsensor": [ - 'addList("sensor", d, haName=" Battery Level", hiveType="Battery")', - 'addList("sensor", d, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", d, haName=" Battery Level", hiveType="Battery", category="diagnostic")', + 'addList("sensor", d, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], "hub": [ 'addList("binary_sensor", d, haName="Hive Hub Status", hiveType="Connectivity")', ], "motionsensor": [ 'addList("sensor", d, haName=" Battery Level", hiveType="Battery")', - 'addList("sensor", d, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", d, haName=" Availability", hiveType="Availability", custom=False)', ], "sense": [ 'addList("binary_sensor", d, haName="Hive Hub Status", hiveType="Connectivity")', ], "siren": ['addList("alarm_control_panel", d)'], "thermostatui": [ - 'addList("sensor", d, haName=" Battery Level", hiveType="Battery")', - 'addList("sensor", d, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", d, haName=" Battery Level", hiveType="Battery", category="diagnostic", )', + 'addList("sensor", d, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], "trv": [ - 'addList("sensor", d, haName=" Battery Level", hiveType="Battery")', - 'addList("sensor", d, haName=" Availability", hiveType="Availability", custom=True)', + 'addList("sensor", d, haName=" Battery Level", hiveType="Battery", category="diagnostic",)', + 'addList("sensor", d, haName=" Availability", hiveType="Availability", category="diagnostic", custom=False)', ], }