Code Monkey home page Code Monkey logo

Comments (6)

sfudeus avatar sfudeus commented on August 20, 2024

Can you provide the full output of dump_parameters and the log output when using --debug in normal mode?
I don't have a HmIP-SWDO myself, so I cannot debug myself.

from homematic_exporter.

mic0rr avatar mic0rr commented on August 20, 2024
--dump_parameters 0000DD89A33234:0
getParamset:
{'CONFIG_PENDING': False,
 'DUTY_CYCLE': False,
 'ERROR_CODE': 0,
 'LOW_BAT': False,
 'OPERATING_VOLTAGE': 1.4,
 'OPERATING_VOLTAGE_STATUS': 0,
 'RSSI_DEVICE': -85,
 'SABOTAGE': False,
 'UNREACH': False,
 'UPDATE_PENDING': False}

At channel :1 STATE represents Closed 0, Open 1

--dump_parameters 0000DD89A33234:1
getParamset:
{'STATE': 0}
--dump_parameters 0000DD89A33234:2
getParamset:
{}

Debug log part of SWDO device. Complete log with all devices attached as file

2022-10-20 20:17:58,263 - INFO - Found top-level device 0000DD89A33234 of type HMIP-SWDO with 3 children
2022-10-20 20:17:58,265 - DEBUG - {'ADDRESS': '0000DD89A33234',
 'AES_ACTIVE': 1,
 'AVAILABLE_FIRMWARE': '0.0.0',
 'CHILDREN': ['0000DD89A33234:0', '0000DD89A33234:1', '0000DD89A33234:2'],
 'DIRECTION': 0,
 'FIRMWARE': '1.16.8',
 'FIRMWARE_UPDATE_STATE': 'UP_TO_DATE',
 'FLAGS': 1,
 'GROUP': '',
 'INDEX': 0,
 'INTERFACE': '',
 'LINK_SOURCE_ROLES': '',
 'LINK_TARGET_ROLES': '',
 'PARAMSETS': ['MASTER', 'SERVICE'],
 'PARENT': '',
 'PARENT_TYPE': '',
 'RF_ADDRESS': 8201009,
 'ROAMING': 0,
 'RX_MODE': 4,
 'SUBTYPE': 'SWD',
 'TEAM': '',
 'TEAM_CHANNELS': [],
 'TEAM_TAG': '',
 'TYPE': 'HMIP-SWDO',
 'UPDATABLE': True,
 'VERSION': 2}
2022-10-20 20:17:58,265 - DEBUG - Found device 0000DD89A33234:0 of type MAINTENANCE in supported parent type HMIP-SWDO
2022-10-20 20:17:58,266 - DEBUG - {'ADDRESS': '0000DD89A33234:0',
 'AES_ACTIVE': 1,
 'AVAILABLE_FIRMWARE': '',
 'CHILDREN': [],
 'DIRECTION': 0,
 'FIRMWARE': '',
 'FIRMWARE_UPDATE_STATE': '',
 'FLAGS': 1,
 'GROUP': '',
 'INDEX': 0,
 'INTERFACE': '',
 'LINK_SOURCE_ROLES': '',
 'LINK_TARGET_ROLES': '',
 'PARAMSETS': ['MASTER', 'VALUES', 'SERVICE'],
 'PARENT': '0000DD89A33234',
 'PARENT_TYPE': 'HMIP-SWDO',
 'RF_ADDRESS': 0,
 'ROAMING': 0,
 'RX_MODE': 0,
 'SUBTYPE': '',
 'TEAM': '',
 'TEAM_CHANNELS': [],
 'TEAM_TAG': '',
 'TYPE': 'MAINTENANCE',
 'UPDATABLE': True,
 'VERSION': 2}
2022-10-20 20:17:58,299 - DEBUG - Found BOOL param SABOTAGE with value False
2022-10-20 20:17:58,299 - DEBUG - Found BOOL param CONFIG_PENDING with value False
2022-10-20 20:17:58,300 - DEBUG - Found BOOL param DUTY_CYCLE with value False
2022-10-20 20:17:58,300 - DEBUG - Found BOOL param LOW_BAT with value False
2022-10-20 20:17:58,300 - DEBUG - Found BOOL param INSTALL_TEST with value None
2022-10-20 20:17:58,301 - DEBUG - Found BOOL param UNREACH with value False
2022-10-20 20:17:58,301 - DEBUG - Found ENUM: desc: {'MIN': 'NORMAL', 'OPERATIONS': 5, 'MAX': 'EXTERNAL', 'FLAGS': 1, 'ID': 'OPERATING_VOLTAGE_STATUS', 'TYPE': 'ENUM', 'DEFAULT': 'NORMAL', 'VALUE_LIST': ['NORMAL', 'UNKNOWN', 'OVERFLOW', 'EXTERNAL']} key: 0
2022-10-20 20:17:58,301 - DEBUG - Found INTEGER param RSSI_DEVICE with value -85
2022-10-20 20:17:58,302 - DEBUG - Found FLOAT param OPERATING_VOLTAGE with value 1.4
2022-10-20 20:17:58,302 - DEBUG - Found INTEGER param RSSI_PEER with value None
2022-10-20 20:17:58,302 - DEBUG - Found INTEGER param ERROR_CODE with value 0
2022-10-20 20:17:58,302 - DEBUG - Found BOOL param UPDATE_PENDING with value False
2022-10-20 20:17:58,303 - DEBUG - ParamsetDescription for 0000DD89A33234:0
2022-10-20 20:17:58,307 - DEBUG - {'CONFIG_PENDING': {'DEFAULT': False,
                    'FLAGS': 9,
                    'ID': 'CONFIG_PENDING',
                    'MAX': True,
                    'MIN': False,
                    'OPERATIONS': 5,
                    'TYPE': 'BOOL'},
 'DUTY_CYCLE': {'DEFAULT': False,
                'FLAGS': 1,
                'ID': 'DUTY_CYCLE',
                'MAX': True,
                'MIN': False,
                'OPERATIONS': 5,
                'TYPE': 'BOOL'},
 'ERROR_CODE': {'DEFAULT': 0,
                'FLAGS': 9,
                'ID': 'ERROR_CODE',
                'MAX': 255,
                'MIN': 0,
                'OPERATIONS': 5,
                'TYPE': 'INTEGER'},
 'INSTALL_TEST': {'DEFAULT': False,
                  'FLAGS': 2,
                  'ID': 'INSTALL_TEST',
                  'MAX': True,
                  'MIN': False,
                  'OPERATIONS': 3,
                  'TYPE': 'BOOL'},
 'LOW_BAT': {'DEFAULT': False,
             'FLAGS': 9,
             'ID': 'LOW_BAT',
             'MAX': True,
             'MIN': False,
             'OPERATIONS': 5,
             'TYPE': 'BOOL'},
 'OPERATING_VOLTAGE': {'DEFAULT': 0.0,
                       'FLAGS': 1,
                       'ID': 'OPERATING_VOLTAGE',
                       'MAX': 25.2,
                       'MIN': 0.0,
                       'OPERATIONS': 5,
                       'TYPE': 'FLOAT'},
 'OPERATING_VOLTAGE_STATUS': {'DEFAULT': 'NORMAL',
                              'FLAGS': 1,
                              'ID': 'OPERATING_VOLTAGE_STATUS',
                              'MAX': 'EXTERNAL',
                              'MIN': 'NORMAL',
                              'OPERATIONS': 5,
                              'TYPE': 'ENUM',
                              'VALUE_LIST': ['NORMAL',
                                             'UNKNOWN',
                                             'OVERFLOW',
                                             'EXTERNAL']},
 'RSSI_DEVICE': {'DEFAULT': 0,
                 'FLAGS': 1,
                 'ID': 'RSSI_DEVICE',
                 'MAX': 127,
                 'MIN': -128,
                 'OPERATIONS': 5,
                 'TYPE': 'INTEGER'},
 'RSSI_PEER': {'DEFAULT': 0,
               'FLAGS': 1,
               'ID': 'RSSI_PEER',
               'MAX': 127,
               'MIN': -128,
               'OPERATIONS': 5,
               'TYPE': 'INTEGER'},
 'SABOTAGE': {'CONTROL': 'MAINTENANCE.SABOTAGE',
              'DEFAULT': False,
              'FLAGS': 9,
              'ID': 'SABOTAGE',
              'MAX': True,
              'MIN': False,
              'OPERATIONS': 5,
              'TYPE': 'BOOL'},
 'UNREACH': {'DEFAULT': False,
             'FLAGS': 25,
             'ID': 'UNREACH',
             'MAX': True,
             'MIN': False,
             'OPERATIONS': 5,
             'TYPE': 'BOOL'},
 'UPDATE_PENDING': {'DEFAULT': False,
                    'FLAGS': 9,
                    'ID': 'UPDATE_PENDING',
                    'MAX': True,
                    'MIN': False,
                    'OPERATIONS': 5,
                    'TYPE': 'BOOL'}}
2022-10-20 20:17:58,308 - DEBUG - Paramset for 0000DD89A33234:0
2022-10-20 20:17:58,308 - DEBUG - {'CONFIG_PENDING': False,
 'DUTY_CYCLE': False,
 'ERROR_CODE': 0,
 'LOW_BAT': False,
 'OPERATING_VOLTAGE': 1.4,
 'OPERATING_VOLTAGE_STATUS': 0,
 'RSSI_DEVICE': -85,
 'SABOTAGE': False,
 'UNREACH': False,
 'UPDATE_PENDING': False}
2022-10-20 20:17:58,308 - DEBUG - Found device 0000DD89A33234:1 of type SHUTTER_CONTACT in supported parent type HMIP-SWDO
2022-10-20 20:17:58,309 - DEBUG - {'ADDRESS': '0000DD89A33234:1',
 'AES_ACTIVE': 1,
 'AVAILABLE_FIRMWARE': '',
 'CHILDREN': [],
 'DIRECTION': 1,
 'FIRMWARE': '',
 'FIRMWARE_UPDATE_STATE': '',
 'FLAGS': 1,
 'GROUP': '',
 'INDEX': 1,
 'INTERFACE': '',
 'LINK_SOURCE_ROLES': 'CONDITIONAL_SWITCH WINDOW_SWITCH',
 'LINK_TARGET_ROLES': '',
 'PARAMSETS': ['MASTER', 'VALUES', 'LINK', 'SERVICE'],
 'PARENT': '0000DD89A33234',
 'PARENT_TYPE': 'HMIP-SWDO',
 'RF_ADDRESS': 0,
 'ROAMING': 0,
 'RX_MODE': 0,
 'SUBTYPE': '',
 'TEAM': '',
 'TEAM_CHANNELS': [],
 'TEAM_TAG': '',
 'TYPE': 'SHUTTER_CONTACT',
 'UPDATABLE': True,
 'VERSION': 2}
2022-10-20 20:17:58,335 - DEBUG - Found ENUM: desc: {'MIN': 'CLOSED', 'UNIT': '""', 'OPERATIONS': 5, 'MAX': 'OPEN', 'FLAGS': 1, 'ID': 'STATE', 'TAB_ORDER': 0, 'TYPE': 'ENUM', 'DEFAULT': 'CLOSED', 'VALUE_LIST': ['CLOSED', 'OPEN'], 'CONTROL': 'DOOR_SENSOR.STATE'} key: 0
2022-10-20 20:17:58,335 - DEBUG - ParamsetDescription for 0000DD89A33234:1
2022-10-20 20:17:58,336 - DEBUG - {'STATE': {'CONTROL': 'DOOR_SENSOR.STATE',
           'DEFAULT': 'CLOSED',
           'FLAGS': 1,
           'ID': 'STATE',
           'MAX': 'OPEN',
           'MIN': 'CLOSED',
           'OPERATIONS': 5,
           'TAB_ORDER': 0,
           'TYPE': 'ENUM',
           'UNIT': '""',
           'VALUE_LIST': ['CLOSED', 'OPEN']}}
2022-10-20 20:17:58,336 - DEBUG - Paramset for 0000DD89A33234:1
2022-10-20 20:17:58,336 - DEBUG - {'STATE': 0}
2022-10-20 20:17:58,336 - DEBUG - Found device 0000DD89A33234:2 of type ALARM_COND_SWITCH_TRANSMITTER in supported parent type HMIP-SWDO
2022-10-20 20:17:58,337 - DEBUG - {'ADDRESS': '0000DD89A33234:2',
 'AES_ACTIVE': 1,
 'AVAILABLE_FIRMWARE': '',
 'CHILDREN': [],
 'DIRECTION': 0,
 'FIRMWARE': '',
 'FIRMWARE_UPDATE_STATE': '',
 'FLAGS': 0,
 'GROUP': '',
 'INDEX': 2,
 'INTERFACE': '',
 'LINK_SOURCE_ROLES': '',
 'LINK_TARGET_ROLES': '',
 'PARAMSETS': ['MASTER', 'VALUES', 'SERVICE'],
 'PARENT': '0000DD89A33234',
 'PARENT_TYPE': 'HMIP-SWDO',
 'RF_ADDRESS': 0,
 'ROAMING': 0,
 'RX_MODE': 0,
 'SUBTYPE': '',
 'TEAM': '',
 'TEAM_CHANNELS': [],
 'TEAM_TAG': '',
 'TYPE': 'ALARM_COND_SWITCH_TRANSMITTER',
 'UPDATABLE': True,
 'VERSION': 2}

exporter-debug.txt

from homematic_exporter.

Unostot avatar Unostot commented on August 20, 2024

Hello,

I've played a bit around and found the reason somehow. Window Sensors only show up in the metrics, when open.

homematic_state_set{ccu="x.x.x.x",device="ABCDEF01234567:1",device_type="SHUTTER_CONTACT",homematic_state_set="CLOSED",mapped_name="Fenster",parent_device_type="HMIP-SWDO"} 0.0
homematic_state_set{ccu="x.x.x.x",device="ABCDEF01234567:1",device_type="SHUTTER_CONTACT",homematic_state_set="OPEN",mapped_name="Fenster",parent_device_type="HMIP-SWDO"} 1.0

since there is a

if not value:
  return

in the process_enum the window enum gets only processed somehow, when it is open.
I've just scanned a bit through the code, so I don't habe a real understanding how it (should) work or why it is written this way.

So this is just some comment to let you know, the SDWO (and probably other window/door sensors) is somehow working, but I'm not sure if this is like it should be. In the current state it seems like all enum values are put into a gauge (and given a value of 0 or 1 depending on "this enum value is on or not), when the read value of the enum is different from zero/false. Otherwise those enums are missing completely.

I would like a metric like "window open" = 1/0 which is always available (instead of current mode: "no metric" or "2 metrics: open=1, closed=0"), but I'm not sure at the moment, how sfudeus has planned this exporter or how he wants/needs the metrics exported.

So perhaps I just have a different approach how I would like my homematic metrics exported. Some explanation how the structure of the data is intended to be used would be nice :)

Greetings,
Uno

Edit: I seems that the enums stay visible after they got "switched on" one time (at least here there is an increasing number of shutter contacts now exported). So there are two solutions:
open each window once, after each exporter restart or wait for a fix which makes enum metrics available even if they are right now at "zero state"

from homematic_exporter.

Unostot avatar Unostot commented on August 20, 2024

Ok, some more testing shows, that the window states get updated only, when STATE = 1.

After this the metric is still exported, but when the window gets closed, it will not update. So it stays with the open state. (probably because with STATE = 0 the enum function returns immediatly)

from homematic_exporter.

sfudeus avatar sfudeus commented on August 20, 2024

The analysis from @Unostot is mostly correct I think.
The cause of this issues is a defect check for the value - and if it is set for the first item in the enum (with index 0), then the update is not done. This is easily fixed.

The other problem is that the handling for enums (esp. for bi-state enums like open/closed) is not intuitive. This is caused by two reasons:

  • I don't want to add too many sensor specific metrics, because they'd all need to be maintained specifically.
  • Prometheus only handles numeric values, so state metrics are handled with a metric with a state label and only a single one will have the value 1, the others will have 0. This is used in this case as well. You don't need to evaluate both in this case, monitoring the open state will be sufficient, because open=0 will mean it is closed :-).

from homematic_exporter.

Unostot avatar Unostot commented on August 20, 2024

Thanks for the fix :)

from homematic_exporter.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.