mikekap / wink-mqtt-rs

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

Getting an error #16

Open jmayes2 opened 3 years ago

jmayes2 commented 3 years ago

Trying to use this on a very old software hub and getting this error on the cmd line for each detected device

'WARN async_failure, error: SimpleError { err: "Output does not match regex:'

no records appear to be going out to my broker. Can I assume this is because of the old firmware (old apontest)

TX, J

mikekap commented 3 years ago

Hey there! Thanks for giving this a try. Indeed it seems like the aprontest binary you have outputs in a different format than the one with which I’m testing.

Could you paste the output of “aprontest -l” and “aprontest -l -m N” where “N” are all the device ids you see in the first command? I can roll out a fix pretty quickly after I have those!

jmayes2 commented 3 years ago

Hi, Thank you for getting back to me! I was getting nowhere trying to get my hub to update, have it too hacked up to connect to their servers anymore.

[root@flex-dvt ~]# aprontest -l
Found 4 devices in database...
MASTERID |     INTERCONNECT |                         USERNAME
       1 |           ZIGBEE |                         LV_Lamp1
       2 |           ZIGBEE |                         LV_Lamp2
       3 |           ZIGBEE |                      Fireplace-L
       4 |           ZIGBEE |                      Fireplace-R

[root@flex-dvt ~]# aprontest -l -m 1
Device has 2 attributes...
LV_Lamp1
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |            0 |
       0

[root@flex-dvt ~]# aprontest -l -m 2
Device has 2 attributes...
LV_Lamp2
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |            0 |
      10

[root@flex-dvt ~]# aprontest -l -m 3
Device has 2 attributes...
Fireplace-L
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |          254 |
     254

[root@flex-dvt ~]# aprontest -l -m 4
Device has 2 attributes...
Fireplace-R
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |          254 |
     254

[root@flex-dvt ~]#

I am not exactly sure what I need to do once the server is working, will the devices just show up in HA or do I need to add an integration?

Thankx again for your help! J

On Thu, Dec 10, 2020 at 12:45 PM Mike Kaplinskiy notifications@github.com wrote:

Hey there! Thanks for giving this a try. Indeed it seems like the aprontest binary you have outputs in a different format than the one with which I’m testing.

Could you paste the output of “aprontest -l” and “aprontest -l -m N” where “N” are all the device ids you see in the first command? I can roll out a fix pretty quickly after I have those!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mikekap/wink-mqtt-rs/issues/16#issuecomment-742681430, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOELA6M43YT6ILURX6NFYK3SUECKVANCNFSM4USF4M5A .

BobRyan530 commented 3 years ago

I'm getting a different error but potentially related. I had a new, unopened, hub I pulled out yesterday and rooted before ever connecting it to the internet. I think I got it updated to the most current release. I setup homeassistant for the first time today and while I'm able to control the device using aprontest I can't seem to control it through MQTT. Attempting to publish a packet to topic 'home/wink/1/set' with payload '{"On_Off": 0}' I'm getting the failure below

Dec 12 02:17:49.453 WARN async_failure, error: SimpleError { err: "Bad attribute type: STRING" }, type: poll_device
Dec 12 02:17:59.380 WARN async_failure, error: SimpleError { err: "Bad attribute type: STRING" }, type: poll_device
Dec 12 02:18:09.540 WARN async_failure, error: SimpleError { err: "Bad attribute type: STRING" }, type: poll_device

[root@flex-dvt ~]# aprontest -u -m 1 -t 1 -v OFF
Update device with master ID 1, setting value OFF for attribute 1
Waiting for 1 callbacks...
Received a myNodeDataCallback from Zigbee
                Source: aprontest
                Event:  RADIO_EVT_NODE_UPDATE
                Status: FLX_OK
                Node:   1
[root@flex-dvt ~]# aprontest -u -m 1 -t 1 -v ON
Update device with master ID 1, setting value ON for attribute 1
Waiting for 1 callbacks...
Received a myNodeDataCallback from Zigbee
                Source: aprontest
                Event:  RADIO_EVT_NODE_UPDATE
                Status: FLX_OK
                Node:   1

[root@flex-dvt ~]# aprontest -l
Found 1 devices in database...
MASTERID |     INTERCONNECT |                         USERNAME
       1 |           ZIGBEE |            New HA Dimmable Light

Found 0 master groups in database...
GROUP ID |             NAME |            RADIO |

Found 0 control groups in database...
GROUP ID |             NAME |            RADIO |

[root@flex-dvt ~]# aprontest -l -m 1
Gang ID: 0x7ce8f9f9
Manufacturer ID: 0x10dc, Product Number: 0xdfbf
Device is ONLINE, 0 failed tx attempts, 4 seconds since last msg rx'ed, polling period 0 seconds
Device has 14 attributes...
New HA Dimmable Light
   ATTRIBUTE |                         DESCRIPTION |   TYPE | MODE |                              GET |                              SET
           1 |                              On_Off | STRING |  R/W |                              OFF |                              OFF
           2 |                               Level |  UINT8 |  R/W |                              254 |
           4 |                         NameSupport |  UINT8 |    R |                                0 |
       61440 |                          ZCLVersion |  UINT8 |    R |                                1 |
       61441 |                  ApplicationVersion |  UINT8 |    R |                                2 |
       61442 |                        StackVersion |  UINT8 |    R |                                2 |
       61443 |                           HWVersion |  UINT8 |    R |                                1 |
       61444 |                    ManufacturerName | STRING |    R |                               GE |
       61445 |                     ModelIdentifier | STRING |    R |                        SoftWhite |
       61446 |                            DateCode | STRING |    R |                         20150515 |
       61447 |                         PowerSource |  UINT8 |    R |                                1 |
      258048 |                        IdentifyTime | UINT16 |  R/W |                                0 |
     1699842 |               ZB_CurrentFileVersion | UINT32 |    R |                         33554952 |
  4294901760 |                   WK_TransitionTime | UINT16 |  R/W |                                  |

EDIT:
version information
[root@flex-dvt ~]# grep 0 /database/cf*
/database/cf_build:00.01
/database/cf_fver2:00.01
/database/cf_fver3:04.01
mikekap commented 3 years ago

Sorry for the duplicate post, just wanted to include formatted aprontest output:

[root@flex-dvt ~]# aprontest -l
Found 4 devices in database...
MASTERID |     INTERCONNECT |                         USERNAME
       1 |           ZIGBEE |                         LV_Lamp1
       2 |           ZIGBEE |                         LV_Lamp2
       3 |           ZIGBEE |                      Fireplace-L
       4 |           ZIGBEE |                      Fireplace-R

[root@flex-dvt ~]# aprontest -l -m 1
Device has 2 attributes...
LV_Lamp1
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |            0 |
       0

[root@flex-dvt ~]# aprontest -l -m 2
Device has 2 attributes...
LV_Lamp2
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |            0 |
      10

[root@flex-dvt ~]# aprontest -l -m 3
Device has 2 attributes...
Fireplace-L
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |          254 |
     254

[root@flex-dvt ~]# aprontest -l -m 4
Device has 2 attributes...
Fireplace-R
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |
     SET
        1 |                    On_Off | STRING |  R/W |           ON |
      ON
        2 |                     Level |  UINT8 |  R/W |          254 |
     254

[root@flex-dvt ~]#
mikekap commented 3 years ago

This should be fixed in 0.1.4 - just re-run the installation command and let me know if you find any more issues!

jmayes2 commented 3 years ago

Now I am getting "Segmentation fault" when I try to run it.

On Sat, Dec 12, 2020 at 11:16 PM Mike Kaplinskiy notifications@github.com wrote:

This should be fixed in 0.1.4 - just re-run the installation command and let me know if you find any more issues!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mikekap/wink-mqtt-rs/issues/16#issuecomment-743946268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOELA6MXBW34SR7GH4NDCJDSUQ53FANCNFSM4USF4M5A .

mikekap commented 3 years ago

That's unfortunate - sorry to hear that! Segmentation fault is pretty weird - wink-mqtt-rs doesn't use any unsafe code itself, so it's definitely a head scratcher.

Do you have any more information before the crash? Does anything get printed in the log file (/var/log/wink-mqtt-rs.log) at all? (e.g. INFO init_logger, min_log_level: Info or similar). If you do have some logging, could you try adding -vvv to the command line args (lives at /opt/wink-mqtt-rs/config) to print as much output as it can?

If there aren't any logs, if you could get a core dump, that would help. Try running ulimit -c unlimited before starting wink-mqtt-rs.

In theory the old firmware should be uninteresting for the actual binary - the binary completely statically linked and isolated from the host filesystem. As part of releasing 0.1.5 I did upgrade rust itself, so maybe that's the cause somehow?

jmayes2 commented 3 years ago

Sorry, I have been to busy to get back to you sooner. I made progress using my other hub (same firmware ver). No segmentation error now. I need to reinstall it again on the other hub, I think the file is corrupt. FYI this firmware does not support the install command you provided. The SSH is outdated plus TAR does not support the z option. I have to manually import the tar.gz then unzip and untar.

Now that it's running I get this in the log;

Jan 02 04:07:50.371 INFO init_logger, min_log_level: Info Jan 02 04:07:50.372 INFO starting, version: 0.1.5 Jan 02 04:07:50.373 INFO opening_client, client_id: wink-mqtt-rs, port: 1883, h$ Jan 02 04:07:50.379 INFO poller_starting, resync_interval: 10000 Jan 02 04:07:50.508 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:50.810 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:50.884 INFO discovered_device, name: LV_Lamp1, id: 1 Jan 02 04:07:51.037 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:51.227 INFO discovered_device, name: LV_Lamp2, id: 2 Jan 02 04:07:51.267 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:51.491 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:51.498 INFO discovered_device, name: Fireplace-L, id: 3 Jan 02 04:07:51.776 INFO discovered_device, name: Fireplace-R, id: 4 Jan 02 04:07:51.784 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:52.029 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$ Jan 02 04:07:52.257 WARN loop_encountered_error, err: Io(Custom { kind: Invalid$

It continues with the loop_encountered_error error over and over.

Thankx again for working on this! J

mikekap commented 3 years ago

hey @jmayes2 - I think you're using something that cuts off the output on the right. Could you try just using cat /var/log/wink-mqtt-rs.log to get the full output?

mikekap commented 3 years ago

Sorry for the spam, but could you test if this setup script works on your hub?

curl -L --cacert /etc/ssl/certs/ca-certificates.crt https://github.com/mikekap/wink-mqtt-rs/releases/latest/download/wink-mqtt-rs.tar.gz | gzip -d | tar -C / -xvf - && /opt/wink-mqtt-rs/setup.sh

If not, could bother you to try some of these commands so I know what's available?

wget --help
curl --help
gzip --help
gunzip --help
tar --help
tree /etc/ssl/
jmayes2 commented 3 years ago

Good news, I re-transferred the file to my 1st hub and no error, the log shows my devices were discovered and using mqtt monitor in home assistant I see the devices change state but no new devices in HA, is there some configuration I need to do in HA, load an add-on? (I used the prefix 'wink' ) I will get you the install info in a few. Thankx again, J

jmayes2 commented 3 years ago

When I run the new install line I get this...

[root@flex-dvt var]# curl -L --cacert /etc/ssl/certs/ca-certificates.crt https:/ /github.com/mikekap/wink-mqtt-rs/releases/latest/download/wink-mqtt-rs.tar.gz | gzip -d | tar -C / -xvf - && /opt/wink-mqtt-rs/setup.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. gzip: invalid magic tar: short read [root@flex-dvt var]# curl -L --cacert /etc/ssl/certs/ca-certificates.crt https:/ /github.com/mikekap/wink-mqtt-rs/releases/latest/download/wink-mqtt-rs.tar.gz | gzip -d | tar -C / -xvf - && /opt/wink-mqtt-rs/setup.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs). If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option. If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL). If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option. gzip: invalid magic tar: short read

jmayes2 commented 3 years ago

[root@flex-dvt var]# wget --help BusyBox v1.22.1 (2014-03-26 18:26:55 EDT) multi-call binary.

Usage: wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

    -s      Spider mode - only check file existence
    -c      Continue retrieval of aborted transfer
    -q      Quiet
    -P DIR  Save to DIR (default .)
    -T SEC  Network read timeout is SEC seconds
    -O FILE Save to FILE ('-' for stdout)
    -U STR  Use STR for User-Agent header
    -Y      Use proxy ('on' or 'off')

[root@flex-dvt var]# curl --help Usage: curl [options...] Options: (H) means HTTP/HTTPS only, (F) means FTP only --anyauth Pick "any" authentication method (H) -a, --append Append to target file when uploading (F/SFTP) --basic Use HTTP Basic Authentication (H) --cacert FILE CA certificate to verify peer against (SSL) --capath DIR CA directory to verify peer against (SSL) -E, --cert CERT[:PASSWD] Client certificate file and password (SSL) --cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL) --ciphers LIST SSL ciphers to use (SSL) --compressed Request compressed response (using deflate or gzip) -K, --config FILE Specify which config file to read --connect-timeout SECONDS Maximum time allowed for connection -C, --continue-at OFFSET Resumed transfer offset -b, --cookie STRING/FILE String or file to read cookies from (H) -c, --cookie-jar FILE Write cookies to this file after operation (H) --create-dirs Create necessary local directory hierarchy --crlf Convert LF to CRLF in upload --crlfile FILE Get a CRL list in PEM format from the given file -d, --data DATA HTTP POST data (H) --data-ascii DATA HTTP POST ASCII data (H) --data-binary DATA HTTP POST binary data (H) --data-urlencode DATA HTTP POST data url encoded (H) --delegation STRING GSS-API delegation permission --digest Use HTTP Digest Authentication (H) --disable-eprt Inhibit using EPRT or LPRT (F) --disable-epsv Inhibit using EPSV (F) --dns-servers DNS server addrs to use: 1.1.1.1;2.2.2.2 --dns-interface Interface to use for DNS requests --dns-ipv4-addr IPv4 address to use for DNS requests, dot notation --dns-ipv6-addr IPv6 address to use for DNS requests, dot notation -D, --dump-header FILE Write the headers to this file --egd-file FILE EGD socket path for random data (SSL) --engine ENGINE Crypto engine (SSL). "--engine list" for list -f, --fail Fail silently (no output at all) on HTTP errors (H) -F, --form CONTENT Specify HTTP multipart POST data (H) --form-string STRING Specify HTTP multipart POST data (H) --ftp-account DATA Account data string (F) --ftp-alternative-to-user COMMAND String to replace "USER [name]" (F) --ftp-create-dirs Create the remote dirs if not present (F) --ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F) --ftp-pasv Use PASV/EPSV instead of PORT (F) -P, --ftp-port ADR Use PORT with given address instead of PASV (F) --ftp-skip-pasv-ip Skip the IP address for PASV (F) --ftp-pret Send PRET before PASV (for drftpd) (F) --ftp-ssl-ccc Send CCC after authenticating (F) --ftp-ssl-ccc-mode ACTIVE/PASSIVE Set CCC mode (F) --ftp-ssl-control Require SSL/TLS for ftp login, clear for transfer (F) -G, --get Send the -d data with a HTTP GET (H) -g, --globoff Disable URL sequences and ranges using {} and [] -H, --header LINE Custom header to pass to server (H) -I, --head Show document info only -h, --help This help text --hostpubmd5 MD5 Hex encoded MD5 string of the host public key. (SSH) -0, --http1.0 Use HTTP 1.0 (H) --http1.1 Use HTTP 1.1 (H) --http2.0 Use HTTP 2.0 (H) --ignore-content-length Ignore the HTTP Content-Length header -i, --include Include protocol headers in the output (H/F) -k, --insecure Allow connections to SSL sites without certs (H) --interface INTERFACE Specify network interface/address to use -4, --ipv4 Resolve name to IPv4 address -6, --ipv6 Resolve name to IPv6 address -j, --junk-session-cookies Ignore session cookies read from file (H) --keepalive-time SECONDS Interval between keepalive probes --key KEY Private key file name (SSL/SSH) --key-type TYPE Private key file type (DER/PEM/ENG) (SSL) --krb LEVEL Enable Kerberos with specified security level (F) --libcurl FILE Dump libcurl equivalent code of this command line --limit-rate RATE Limit transfer speed to this rate -l, --list-only List only mode (F/POP3) --local-port RANGE Force use of these local port numbers -L, --location Follow redirects (H) --location-trusted like --location and send auth to other hosts (H) -M, --manual Display the full manual --mail-from FROM Mail from this address (SMTP) --mail-rcpt TO Mail to this/these addresses (SMTP) --mail-auth AUTH Originator address of the original email (SMTP) --max-filesize BYTES Maximum file size to download (H/F) --max-redirs NUM Maximum number of redirects allowed (H) -m, --max-time SECONDS Maximum time allowed for the transfer --metalink Process given URLs as metalink XML file --negotiate Use HTTP Negotiate Authentication (H) -n, --netrc Must read .netrc for user name and password --netrc-optional Use either .netrc or URL; overrides -n --netrc-file FILE Set up the netrc filename to use -N, --no-buffer Disable buffering of the output stream --no-keepalive Disable keepalive use on the connection --no-sessionid Disable SSL session-ID reusing (SSL) --noproxy List of hosts which do not use proxy --ntlm Use HTTP NTLM authentication (H) --oauth2-bearer TOKEN OAuth 2 Bearer Token (IMAP, POP3, SMTP) -o, --output FILE Write output to instead of stdout --pass PASS Pass phrase for the private key (SSL/SSH) --post301 Do not switch to GET after following a 301 redirect (H) --post302 Do not switch to GET after following a 302 redirect (H) --post303 Do not switch to GET after following a 303 redirect (H) -#, --progress-bar Display transfer progress as a progress bar --proto PROTOCOLS Enable/disable specified protocols --proto-redir PROTOCOLS Enable/disable specified protocols on redirect -x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port --proxy-anyauth Pick "any" proxy authentication method (H) --proxy-basic Use Basic authentication on the proxy (H) --proxy-digest Use Digest authentication on the proxy (H) --proxy-negotiate Use Negotiate authentication on the proxy (H) --proxy-ntlm Use NTLM authentication on the proxy (H) -U, --proxy-user USER[:PASSWORD] Proxy user and password --proxy1.0 HOST[:PORT] Use HTTP/1.0 proxy on given port -p, --proxytunnel Operate through a HTTP proxy tunnel (using CONNECT) --pubkey KEY Public key file name (SSH) -Q, --quote CMD Send command(s) to server before transfer (F/SFTP) --random-file FILE File for reading random data from (SSL) -r, --range RANGE Retrieve only the bytes within a range --raw Do HTTP "raw", without any transfer decoding (H) -e, --referer Referer URL (H) -J, --remote-header-name Use the header-provided filename (H) -O, --remote-name Write output to a file named as the remote file --remote-name-all Use the remote file name for all URLs -R, --remote-time Set the remote file's time on the local output -X, --request COMMAND Specify request command to use --resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS --retry NUM Retry request NUM times if transient problems occur --retry-delay SECONDS When retrying, wait this many seconds between each --retry-max-time SECONDS Retry only within this period --sasl-ir Enable initial response in SASL authentication -S, --show-error Show error. With -s, make curl show errors when they occur -s, --silent Silent mode. Don't output anything --socks4 HOST[:PORT] SOCKS4 proxy on given host + port --socks4a HOST[:PORT] SOCKS4a proxy on given host + port --socks5 HOST[:PORT] SOCKS5 proxy on given host + port --socks5-hostname HOST[:PORT] SOCKS5 proxy, pass host name to proxy -Y, --speed-limit RATE Stop transfers below speed-limit for 'speed-time' secs -y, --speed-time SECONDS Time for trig speed-limit abort. Defaults to 30 --ssl Try SSL/TLS (FTP, IMAP, POP3, SMTP) --ssl-reqd Require SSL/TLS (FTP, IMAP, POP3, SMTP) -2, --sslv2 Use SSLv2 (SSL) -3, --sslv3 Use SSLv3 (SSL) --ssl-allow-beast Allow security flaw to improve interop (SSL) --stderr FILE Where to redirect stderr. - means stdout --tcp-nodelay Use the TCP_NODELAY option -t, --telnet-option OPT=VAL Set telnet option --tftp-blksize VALUE Set TFTP BLKSIZE option (must be >512) -z, --time-cond TIME Transfer based on a time condition -1, --tlsv1 Use TLSv1 (SSL) --trace FILE Write a debug trace to the given file --trace-ascii FILE Like --trace but without the hex output --trace-time Add time stamps to trace/verbose output --tr-encoding Request compressed transfer encoding (H) -T, --upload-file FILE Transfer FILE to destination --url URL URL to work with -B, --use-ascii Use ASCII/text transfer -u, --user USER[:PASSWORD][;OPTIONS] Server user, password and login options --tlsuser USER TLS username --tlspassword STRING TLS password --tlsauthtype STRING TLS authentication type (default SRP) -A, --user-agent STRING User-Agent to send to server (H) -v, --verbose Make the operation more talkative -V, --version Show version number and quit -w, --write-out FORMAT What to output after completion --xattr Store metadata in extended file attributes -q If used as the first parameter disables .curlrc [root@flex-dvt var]# gzip --help BusyBox v1.22.1 (2014-03-26 18:26:55 EDT) multi-call binary.

Usage: gzip [-cfd] [FILE]...

Compress FILEs (or stdin)

    -d      Decompress
    -c      Write to stdout
    -f      Force

[root@flex-dvt var]# gunzip -help gunzip: invalid option -- 'h' BusyBox v1.22.1 (2014-03-26 18:26:55 EDT) multi-call binary.

Usage: gunzip [-cft] [FILE]...

Decompress FILEs (or stdin)

    -c      Write to stdout
    -f      Force
    -t      Test file integrity

[root@flex-dvt var]# tar --help BusyBox v1.22.1 (2014-03-26 18:26:55 EDT) multi-call binary.

Usage: tar -[cxthvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...

Create, extract, or list files from a tar file

Operation: c Create x Extract t List f Name of TARFILE ('-' for stdin/out) C Change to DIR before operation v Verbose O Extract to stdout h Follow symlinks exclude File to exclude X File with names to exclude T File with names to include

[root@flex-dvt var]# tree /etc/ssl/ -sh: tree: not found [root@flex-dvt var]#

jmayes2 commented 3 years ago

Lastly, the 2nd box that was giving me the errors in the log is not actually online with any devices so I think that may have caused the trouble, I have a feeling if I repair it to new devices it will work ok so I think your work is done other then the install. Thankx again for all the hard work! PS, lmk how to get HA to discover the wink MTQQ, if am sure it's just my being a dummy.

mikekap commented 3 years ago

For the old box, try this:

curl -k -L --cacert /etc/ssl/certs/ca-certificates.crt https://github.com/mikekap/wink-mqtt-rs/releases/latest/download/wink-mqtt-rs.tar.gz | gzip -d | tar -C / -xvf - && /opt/wink-mqtt-rs/setup.sh

Please try not to use it anywhere else - the only difference is -k which will disable the "actually make sure this binary is what I meant to download". Hackers and all could cheat you here.

For the hub that works, you do need to add some configuration on home assistant. Specifically, you need these lines in configuration.yaml: https://github.com/mikekap/raspberrypi/blob/master/home-assistant/configuration.yaml#L33-L36 . broker is the hostname that your mqtt server runs on - if it's the same machine as home assistant, you could try localhost.

That will work with the default discovery topic settings on the wink. If you're not using the defaults, you'll need to match the discovery prefix with the one on the wink - just add a discovery_prefix to the config above.

jmayes2 commented 3 years ago

Ok, both hubs working with that install line :) Funny thing, when monitoring mqtt and stopping/starting the your program I would see discovery information then status (repeating). After I did that a few times it stopped sending the discovery info so now that I have the yaml fixed in ha still no devices. I rebooted the hub but still it starts and only sends status. Any thoughts? If I manually set up a light in yaml what would be the topic, I tried brightness but that is not working.

jmayes2 commented 3 years ago

Ok, I duplicated this on both box's. After install I see on the mqtt monitor that when I start the program I get discovery information with '/home/wink/ID' prefix. I use the -t parm and put in 'homeassistant' which then yields '/homeassistantID', there is no '/' between homeassistant and the ID. (Again at this point discovery info is being sent). So I put in '-t homeassistant/' adding the missing slash. Now I get /homeassistant/ID like I should but discovery is no longer sent. As I did on the other box I took the new parms out and it went back to /home/wink/ID but still no discovery is sent, I can't get it to send discovery anymore on either box. Question?, is config information held anywhere else other the the config file in /opt/wink-mqtt-rs/? I can't figure out why it's no longer sending discovery info when I put it back to defaults.

jmayes2 commented 3 years ago

Putting auto discovery aside I am trying to manually add a light to HA via your mqtt, I can set level and turn on/off but status is not returning. This is the YAML I am using,

The mqtt status line looks like this; home/wink/5/status {"level:255,"On_Off":"ON"}

Can you tell me what I need to put on the state topic lines?

Thankx again for all your help, J

mikekap commented 3 years ago

Hey @jmayes2 - let me try to answer those:

jmayes2 commented 3 years ago

Thank you again, that was the template info I needed for the status response. I use the terminal in HA typing mosquitto_sub -u mqtt-username -P mqtt-pwd -v -t '#' to get a running response of all mqtt info, works nicely. Since I use mosquitto, would I still put 'blackberry' to identify the mqtt server in yaml?

I have things working well now but there is weirdness you should know about. After I tried putting in "homeassistant/" with the -t parm both of my installs stopped showing discovery, I know it does not make sense since only the config file has any settings but before I did that I was observing the discovery info each time I rebooted the program using mtqq.sh, now it just starts with status responses every 10 secs. Also when I reboot the mqtt broker or HA your program stops and needs to be restarted in the wink. I have reinstalled but no more discovery info is ever sent.

Lastly, using a zigbee GE bulb which supports parms 1&2 (state & brt) and using parm 1 as the state message something happens that causes a loop, the bulb works fine with brightness commands but once I send "off" the loop starts which spawns multiple apontest entries in the process list and ends up crashing the bulb. I have to stop the program, kill the extra aprontest process's and reset the bulb (kill power for a few secs) to get it working again. As a workaround I changed state to parm 2 (brt) which works fine as it sends a 0 for off and no loops, this info is just fyi.

After the holiday I will put a hub back to before the I used program (I have a backup of the flash and programmer) then run the sequence of events again and take some snapshots of the mqtt data for you to see. In the meantime I am up and running now with many thanks! Happy Holidays, J

mikekap commented 3 years ago

That seems like a reasonable command for doing mqtt listens. blackberry in the home assistant yaml sounds reasonable - honestly so long as home assistant sees ANY mqtt traffic, that part is probably not to blame.

I think the answer has been staring me in the face a little bit. Are you running two hubs with wink-mqtt-rs on both of them, on the same MQTT server? That will probably result in sporadic "liveness" on each of them (check /var/log/wink-mqtt-rs.log) - usually one would connect and the other would be in an infinite retry loop.

To try fix it, try changing the client_id of each hub. Specifically, in the mqtt connection config, instead of -s mqtt://foo try -s mqtt://foo?client_id=second-hub or something similar. The default client_id is wink-mqtt-rs and mqtt doesn't support multiple clients with the same id.

jmayes2 commented 3 years ago

Actually they are two different installs at two different locations. It was definitely a infinite loop that it was going into though when I was using start parm 1 for on/off

On Thu, Dec 24, 2020 at 12:25 AM Mike Kaplinskiy notifications@github.com wrote:

That seems like a reasonable command for doing mqtt listens. blackberry in the home assistant yaml sounds reasonable - honestly so long as home assistant sees ANY mqtt traffic, that part is probably not to blame.

I think the answer has been staring me in the face a little bit. Are you running two hubs with wink-mqtt-rs on both of them, on the same MQTT server? That will probably result in sporadic "liveness" on each of them (check /var/log/wink-mqtt-rs.log) - usually one would connect and the other would be in an infinite retry loop.

To try fix it, try changing the client_id of each hub. Specifically, in the mqtt connection config, instead of -s mqtt://foo try -s mqtt://foo?client_id=second-hub or something similar. The default client_id is wink-mqtt-rs and mqtt doesn't support multiple clients with the same id.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mikekap/wink-mqtt-rs/issues/16#issuecomment-750747516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOELA6KEZI5MZ454QJSXZNLSWLGEDANCNFSM4USF4M5A .