mikekap / wink-mqtt-rs

MQTT Relay for the Jailbroken Wink Hub v1, with Home Assistant MQTT autodiscovery support
Other
14 stars 0 forks source link

No message on <discovery_prefix> when wink-mqtt-rs starts #34

Closed froohoo closed 3 years ago

froohoo commented 3 years ago

Thanks for putting this together. IMO the Wink-1 hardware itself is great and I'm glad you are giving it a second life.

I'm in the process of setting it up with Home Assistant, and I've run into an issue where I don't see anything sent to the mqtt broker on homeassistant/, either when I reboot the wink or restart the service. I'm seeing the mqtt traffic from the wink both in HA and in MQTT explorer, but nothing on homeassistant/. I can manually publish a message to homeassistant/status and that shows up, but I never get one from wink-mqtt-rs

Config:

-s mqtt://hamqtt:*************@192.168.1.111
-d homeassistant

image

mikekap commented 3 years ago

Sorry for the late response here. Are there any log entries from /var/log/wink-mqtt-rs.log? You should see some lines that either say discovered_device or unknown_device.

If you do have lines with unknown_device, could you include the output of aprontest -l and aprontest -l -m 6 (the others are useful too if there are multiple "types" of devices connected to your wink)?

If you don't have any of those lines - could you add -v to your config file? It should increase the logging verbosity to get some more info as to what might be going wrong.

froohoo commented 3 years ago

Thanks Mike, Here is what I get when the log starts up (with verbose logging enabled)

Nodes 2 & 5 are both GE Quirky zigbee window sensors that I don't really use anymore.

Mar 08 21:24:32.154 INFO init_logger, min_log_level: Debug  
Mar 08 21:24:32.157 INFO starting, version: 0.2.0  
Mar 08 21:24:32.274 INFO opening_client, client_id: wink-mqtt-rs, port: 1883, host: 192.168.1.111  
Mar 08 21:24:32.299 INFO poller_starting, resync_interval: 10000  
Mar 08 21:24:32.309 INFO started_http_server, listen_addr: 0.0.0.0:3000  
Mar 08 21:24:32.327 DEBG running_command, cmd: aprontest -l  
Mar 08 21:24:32.603 DEBG running_command, cmd: aprontest -l -m 2  
Mar 08 21:24:32.972 WARN poll_device_failed, error: SimpleError { err: "Bad attribute type: UINT64" }
Mar 08 21:24:33.005 DEBG running_command, cmd: aprontest -l -m 5
Mar 08 21:24:33.226 WARN poll_device_failed, error: SimpleError { err: "Bad attribute type: UINT64" }
Mar 08 21:24:33.227 DEBG running_command, cmd: aprontest -l -m 6
Mar 08 21:24:33.465 DEBG running_command, cmd: aprontest -l -m 7
Mar 08 21:24:33.666 DEBG running_command, cmd: aprontest -l -m 8
Mar 08 21:24:33.880 DEBG running_command, cmd: aprontest -l -m 11
Mar 08 21:24:34.095 DEBG running_command, cmd: aprontest -l -m 12
Mar 08 21:24:34.304 DEBG running_command, cmd: aprontest -l -m 13
Mar 08 21:24:34.511 DEBG running_command, cmd: aprontest -l -m 15
Mar 08 21:24:37.341 WARN loop_encountered_error, err: Timeout(Elapsed(()))
Mar 08 21:24:42.313 DEBG running_command, cmd: aprontest -l
Mar 08 21:24:42.495 DEBG running_command, cmd: aprontest -l -m 2
Mar 08 21:24:42.678 WARN loop_encountered_error, err: Timeout(Elapsed(()))
Mar 08 21:24:42.725 WARN poll_device_failed, error: SimpleError { err: "Bad attribute type: UINT64" }
Mar 08 21:24:42.726 DEBG running_command, cmd: aprontest -l -m 5
Mar 08 21:24:42.945 WARN poll_device_failed, error: SimpleError { err: "Bad attribute type: UINT64" }
Mar 08 21:24:42.946 DEBG running_command, cmd: aprontest -l -m 6
Mar 08 21:24:42.976 DEBG Publish. Topc = home/wink/6/status
Mar 08 21:24:42.976 DEBG Publish. Pkid = 1, Payload Size = 137
Mar 08 21:24:42.978 DEBG Publish. Topc = home/wink/7/status
Mar 08 21:24:42.979 DEBG Publish. Pkid = 2, Payload Size = 139
Mar 08 21:24:42.981 DEBG Publish. Topc = home/wink/8/status
Mar 08 21:24:42.982 DEBG Publish. Pkid = 3, Payload Size = 16
Mar 08 21:24:42.983 DEBG Publish. Topc = home/wink/11/status
Mar 08 21:24:42.984 DEBG Publish. Pkid = 4, Payload Size = 280
Mar 08 21:24:42.985 DEBG Publish. Topc = home/wink/12/status
Mar 08 21:24:42.986 DEBG Publish. Pkid = 5, Payload Size = 136
Mar 08 21:24:42.986 DEBG Publish. Topc = home/wink/13/status
Mar 08 21:24:42.987 DEBG Publish. Pkid = 6, Payload Size = 137
Mar 08 21:24:42.988 DEBG Publish. Topc = home/wink/15/status
Mar 08 21:24:42.988 DEBG Publish. Pkid = 7, Payload Size = 15
Mar 08 21:24:42.989 DEBG Subscribe. Topics = [Filter = home/wink/+/set, Qos = AtLeastOnce], Pkid = 8
Mar 08 21:24:42.990 DEBG Subscribe. Topics = [Filter = home/wink/+/+/set, Qos = AtLeastOnce], Pkid = 9
Mar 08 21:24:42.991 DEBG Subscribe. Topics = [Filter = homeassistant/status, Qos = AtLeastOnce], Pkid = 10
Mar 08 21:24:42.992 DEBG running_command, cmd: aprontest -l
Mar 08 21:24:43.221 DEBG running_command, cmd: aprontest -l -m 7
Mar 08 21:24:43.234 DEBG Publish. Topc = home/wink/6/status
Mar 08 21:24:43.234 DEBG Publish. Pkid = 11, Payload Size = 137
Mar 08 21:24:43.423 DEBG broadcast_discovery, id: 2
Mar 08 21:24:43.424 DEBG running_command, cmd: aprontest -l -m 2
Mar 08 21:24:43.634 DEBG running_command, cmd: aprontest -l -m 8
Mar 08 21:24:43.638 DEBG Publish. Topc = home/wink/7/status
Mar 08 21:24:43.638 DEBG Publish. Pkid = 12, Payload Size = 139
Mar 08 21:24:44.017 WARN broadcast_discovery_failed, error: SimpleError { err: "Bad attribute type: UINT64" }

I removed these nodes (2 & 5) with aprontest -d and... look at that.. I now have homeassistant topic showing up:

image

Seems like a possible opportunity for better error handling?

Here is an output from aprontest -l -m2 , I'm guessing that the IasCieAddress is what is causing the issue (at least in my case)

[root@flex-dvt wink-mqtt-rs]# aprontest -l -m 2
Gang ID: 0x7cfcdb43
Manufacturer ID: 0x1131, Product Number: 0xa047
Device is OFFLINE, 1251 failed tx attempts, 58491281 seconds since last msg rx'ed, polling period 72000 seconds
Device has 24 attributes...
New IAS Zone
   ATTRIBUTE |                         DESCRIPTION |   TYPE | MODE |                              GET |                              SET
       61440 |                          ZCLVersion |  UINT8 |    R |                                  |                                 
       61441 |                  ApplicationVersion |  UINT8 |    R |                                  |                                 
       61442 |                        StackVersion |  UINT8 |    R |                                  |                                 
       61443 |                           HWVersion |  UINT8 |    R |                                  |                                 
       61444 |                    ManufacturerName | STRING |    R |                                  |                                 
       61445 |                     ModelIdentifier | STRING |    R |                                  |                                 
       61446 |                            DateCode | STRING |    R |                                  |                                 
       61447 |                         PowerSource |  UINT8 |    R |                                  |                                 
      127008 |                      BatteryVoltage |  UINT8 |    R |                               26 |                                 
      127029 |                    BatteryAlarmMask |  UINT8 |  R/W |                                  |                                 
      127030 |          BatteryVoltageMinThreshold |  UINT8 |  R/W |                                  |                                 
      127031 |            BatteryVoltageThreshold1 |  UINT8 |  R/W |                                  |                                 
      127032 |            BatteryVoltageThreshold2 |  UINT8 |  R/W |                                  |                                 
      127033 |            BatteryVoltageThreshold3 |  UINT8 |  R/W |                                  |                                 
     1699842 |               ZB_CurrentFileVersion | UINT32 |    R |                        402673953 |                                 
    83947520 |                           ZoneState |  UINT8 |    R |                                1 |                                 
    83947521 |                            ZoneType | UINT16 |    R |                               21 |                                 
    83947522 |                          ZoneStatus | UINT16 |    R |                               48 |                                 
    83947536 |                       IasCieAddress | UINT64 |    R |                 3781220667386638 |                                 
    83947537 |                              ZoneID |  UINT8 |    R |                                  |                                 
    83949200 |                              Alarm1 |  UINT8 |    R |                                0 |                                 
    83949201 |                              Alarm2 |  UINT8 |    R |                                0 |                                 
    83949202 |                         TamperAlarm |  UINT8 |    R |                                0 |                                 
    83949203 |                          LowBattery |  UINT8 |    R |                              200 | 
mikekap commented 3 years ago

Wow that is not a thing I've seen attached to winks before!

The fix above will make it so that all your other devices show up, but I don't think this device type will work with HA autodiscovery. If you can tell me what kind of mqtt device it should be (is it a sensor? a binary sensor? Which of those attributes tell you the value of it? ZoneStatus maybe?) - I can add the autodiscovery payload for that type.

froohoo commented 3 years ago

Thanks Mike for the fix! It is a binary switch sensor for doors / windows. Listing here. They have been discontinued/unavailable since ~2016 I believe. Not telling you how to live your life, but the install base for this product is probably pretty small at this point, and I don't even use them. But if you are really interested I can power one up and let you know which attribute is the closed/open indicator.