nebulous / infinitude

Open control of Carrier/Bryant thermostats
MIT License
225 stars 50 forks source link

Not getting any data from USB RS485 #115

Closed jkfromk closed 3 years ago

jkfromk commented 3 years ago

I am having trouble with getting infinitude with the USB RS485 working

Symptom:

Hardware:

https://smile.amazon.com/gp/product/B07SC2MJ91/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Steps I've done:

when infinitude is started: pi@raspberrypi:~/infinitude $ ./infinitude daemon -m production

Using /dev/ttyUSB0 serial interface
Using 127.0.0.1:23 for serial interface
[2020-12-02 11:01:09.03549] [18367] [info] Listening at "http://*:3000"
Server available at http://127.0.0.1:3000

Not sure what else to try to get it working. Thank you in advance.

nebulous commented 3 years ago

Have you checked to see that serial data is arriving as expected without infinitude? Using minicom for instance? Or you could compile the cardump utility in the contrib directory for a standalone test.

https://github.com/nebulous/infinitude/tree/master/contrib/cardump

Once that part is confirmed working(some people have had substantial trouble with wire gauge mismatches etc) we can troubleshoot the infinitude part of the pipeline, though there isn't really much to that bit. Just browse to the inifinitude homepage and click the Serial tab.

jkfromk commented 3 years ago

I compiled cardump and see data scrolling when running ./cardump < /dev/ttyUSB0.

Also seems the pi is seeing the USB device:

[87351.294711] usb 1-1: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00 [87351.294735] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [87351.294749] usb 1-1: Product: FT232R USB UART [87351.294762] usb 1-1: Manufacturer: FTDI [87351.294775] usb 1-1: SerialNumber: AD0K19NV [87351.311917] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected [87351.312171] usb 1-1: Detected FT232RL [87351.314022] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0

Is there something particular I should be looking for? When I go to the serial tab I am not seeing any data under stream or state.

nebulous commented 3 years ago

cardump should show a stream of serial data, some of which is human readable. Did you see anything after the [87351.314022] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0 line?

jkfromk commented 3 years ago

When running "./cardump < /dev/ttyUSB0"

I am seeing the following scroll by:

Looking for 8 byte frame in 140 byte buffer (The actual bye and buffer values change with each entry)

Side note: I do see info in the other tabs (Status, Comfort, Schedules)

nebulous commented 3 years ago

if cardump doesn't sync and output a stream of actual data, some of which is ASCII text, then there remains an upstream problem from infinitude regarding serial data. I've heard some people have had trouble with using cat5 vs thicker thermostat wire, long runs may also be an issue. 485 is differential, but it may also help to make grounds common/try different adaptor/iterate.

However, you should know that the RS485 support in Infinitude is something of a novelty. It provides some insight into how the different devices on your bus are talking to each other, but is read-only from Infinitude's perspective.

secabeen commented 3 years ago

However, you should know that the RS485 support in Infinitude is something of a novelty. It provides some insight into how the different devices on your bus are talking to each other, but is read-only from Infinitude's perspective.

It may be a novelty, but it's what dragged me into getting a home assistant setup going. I have rs 485 sniffers/links to both my pool pump and my solar inverter, and love getting the data.

nebulous commented 3 years ago

😄 you’re exactly the target demographic then

jlg89 commented 2 years ago

@jkfromk were you able to get your serial comms working? I was running into the same issue. I have maybe a 40ft run of wire. I originally ran rather thin wiring, but just swapped it out for 14ga speaker wire. Then I realized that I had neglected to run "stty < /dev/ttyUSB0 38400 -echo -opost -isig -icanon min 1" and add it to /etc/rc.local so it survives a restart. I then started getting data via cardump:

hoobs@hoobs:~/infinitude/contrib/cardump$ ./cardump < /dev/ttyUSB0
Time    From    To  Type    Length  Hex Content
--------------WRITE to f1 ------------
Write to table 4, row 32
e0 02 c0 00 0f 01 03 f3 02 00 30 3c 50 00 3c 50 00 01 0c 18 ac da 04
1641666303  20  f1  0c  23  00 04 20 e0 02 c0 00 0f 01 03 f3 02 00 30 3c 50 00 3c 50 00 01 0c 18
--------------READ from 42 ------------
Request for table 3, row 13
1641666303  20  42  0b  3   00 03 0d
1641666303  42  20  06  10  00 03 0d 00 00 00 00 00 00 00
--------------READ from 60 ------------
Request for table 3, row 2
1641666303  20  60  0b  3   00 03 02
1641666303  60  20  06  27  00 03 02 04 01 00 00 04 02 00 00 04 03 00 00 04 04 00 00 04 14 00 00 04 1c 00 00

etc.

So, I might not have needed to change the wiring, but oh well. However, I was still not getting serial data on the infinitude web page.

When infinitude starts, I see this in syslog:

Jan 8 12:23:51 localhost infinitude[616]: Using /dev/ttyUSB0 serial interface Jan 8 12:23:51 localhost infinitude[616]: Using 127.0.0.1:23 for serial interface

Then, when I hit the /serial web page:

Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.09881] [653] [debug] Inactivity timeout Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.35870] [653] [debug] GET "/serial" (78dfc693) Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.36127] [653] [debug] Routing to a callback Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.36198] [653] [info] Attempting to access 127.0.0.1:23 Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.36703] [653] [debug] Template "serial.html.ep" not found Jan 8 12:18:09 localhost infinitude[653]: [2022-01-08 12:18:09.36802] [653] [debug] Nothing has been rendered, expecting delayed response

So...it's trying to use the socket instead of the serial. By default, it adds both interfaces to infinitude.json. Once I deleted the "serial_socket":"127.0.0.1:23" entry from infinitude.json, it started working.

jkfromk commented 2 years ago

no afraid not. I used thermostat wire but only able 3 ft of it.