Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending commands doesn’t work #2

Open
kgstorm opened this issue Oct 29, 2021 · 22 comments
Open

Sending commands doesn’t work #2

kgstorm opened this issue Oct 29, 2021 · 22 comments

Comments

@kgstorm
Copy link

kgstorm commented Oct 29, 2021

Awesome code! It was my first time using ESP-IDF, so that was a bit of a learning curve. But once I got the code compiled, the code read all of the states and sent them to home assistant through MQTT perfectly. However, when I send commands it seems that nothing happens. It looks like I have a Pentair EasyTouch part number 521241. Is that different than your model?
Thanks again!

@michaelusner
Copy link
Owner

michaelusner commented Oct 30, 2021 via email

@michaelusner
Copy link
Owner

michaelusner commented Oct 30, 2021 via email

@michaelusner
Copy link
Owner

michaelusner commented Oct 30, 2021 via email

@kgstorm
Copy link
Author

kgstorm commented Oct 31, 2021 via email

@michaelusner
Copy link
Owner

michaelusner commented Nov 1, 2021 via email

@kgstorm
Copy link
Author

kgstorm commented Nov 2, 2021 via email

@michaelusner
Copy link
Owner

michaelusner commented Nov 2, 2021 via email

@rsumner
Copy link

rsumner commented May 2, 2022

Sending commands also isn't working for me. The the circuit will return back to it's previous state. The MQTT command seems to be received with no problem. Here's some output from serial:

I (35183) RS485_PENTAIR_CONTROLLER: Received 47 bytes:
I (35183) RS485_PENTAIR_CONTROLLER: Found header start at offset 7
I (35183) RS485_PENTAIR_CONTROLLER: Source  : (0x10) Main
I (35183) RS485_PENTAIR_CONTROLLER: Dest    : (0x0f) Broadcast
I (35193) RS485_PENTAIR_CONTROLLER: Command : (0x02) 2

I (35203) RS485_PENTAIR_CONTROLLER: Time:        8:9
I (35203) RS485_PENTAIR_CONTROLLER: Pump1:       on
I (35213) RS485_PENTAIR_CONTROLLER: Cleaner:     off
I (35213) RS485_PENTAIR_CONTROLLER: Air Blower:  off
I (35223) RS485_PENTAIR_CONTROLLER: Pool temp:   78
I (35223) RS485_PENTAIR_CONTROLLER: Spa temp:    78
I (35233) RS485_PENTAIR_CONTROLLER: Air temp:    72
I (35233) RS485_PENTAIR_CONTROLLER: Heater:      32
I (35243) RS485_PENTAIR_CONTROLLER: Heater mode: 4
I (35253) RS485_PENTAIR_CONTROLLER: Unknown:     4
I (35253) RS485_PENTAIR_CONTROLLER: Spa:         off
I (35263) RS485_PENTAIR_CONTROLLER: Pool light:  off
I (35263) RS485_PENTAIR_CONTROLLER: Spa light:   off

I (36173) RS485_PENTAIR_CONTROLLER: MQTT_EVENT_DATA
I (36173) RS485_PENTAIR_CONTROLLER: TOPIC='homeassistant/switch/pool/water_feature1/set'

I (36173) RS485_PENTAIR_CONTROLLER: DATA='on'

I (36183) RS485_PENTAIR_CONTROLLER: Switching feature 07 ON **********************
I (36183) RS485_PENTAIR_CONTROLLER: Sending command from=20 to=10 command=86 feature=07 state=01
00 ff a5 1f 10 20 86 02 07 01 01 84 I (36693) RS485_PENTAIR_CONTROLLER: 12
I (37043) RS485_PENTAIR_CONTROLLER: Received 47 bytes:
I (37043) RS485_PENTAIR_CONTROLLER: Found header start at offset 7
I (37043) RS485_PENTAIR_CONTROLLER: Source  : (0x10) Main
I (37043) RS485_PENTAIR_CONTROLLER: Dest    : (0x0f) Broadcast
I (37053) RS485_PENTAIR_CONTROLLER: Command : (0x02) 2

I (37063) RS485_PENTAIR_CONTROLLER: Time:        8:9
I (37063) RS485_PENTAIR_CONTROLLER: Pump1:       on
I (37073) RS485_PENTAIR_CONTROLLER: Cleaner:     off
I (37073) RS485_PENTAIR_CONTROLLER: Air Blower:  off
I (37083) RS485_PENTAIR_CONTROLLER: Pool temp:   78
I (37083) RS485_PENTAIR_CONTROLLER: Spa temp:    78
I (37093) RS485_PENTAIR_CONTROLLER: Air temp:    72
I (37093) RS485_PENTAIR_CONTROLLER: Heater:      32
I (37103) RS485_PENTAIR_CONTROLLER: Heater mode: 4
I (37113) RS485_PENTAIR_CONTROLLER: Unknown:     4
I (37113) RS485_PENTAIR_CONTROLLER: Spa:         off
I (37123) RS485_PENTAIR_CONTROLLER: Pool light:  off
I (37123) RS485_PENTAIR_CONTROLLER: Spa light:   off

I (39153) RS485_PENTAIR_CONTROLLER: Received 127 bytes:
I (39153) RS485_PENTAIR_CONTROLLER: Found header start at offset 7
I (39153) RS485_PENTAIR_CONTROLLER: Source  : (0x10) Main
I (39153) RS485_PENTAIR_CONTROLLER: Dest    : (0x0f) Broadcast
I (39163) RS485_PENTAIR_CONTROLLER: Command : (0x02) 2

I do have a USB-to-RS485 adapter on the way so I can see if the serial commands are making it from my data closet (where the ESP32 resides) to the EasyTouch (about 100 linear feet away). One thing that concerns me is the distance the cheap max485 devboards are capable of.

@michaelusner
Copy link
Owner

michaelusner commented May 2, 2022

@rsumner The same thing is happening for me. I believe it's a race condition where the status message is overwriting the state before it gets written to the controller. I'll try to sort it out because it's preventing HA from effectively controlling things reliably.
If I run MQTTExplorer to probe the values, the problem doesn't happen anymore which is strange.

Regarding your distance concern. I don't know the max distance but from what I read, speed will decrease with distance. One thing you could watch is the number of rejected packets due to checksum error. That should indicate that there's transmission problems.
I don't know that it would depend on the power of the MAX485 adapter or not. That's probably a question for a EE or someone more knowledgeable about the MAX485 than I am.

@jbishop129
Copy link

Same issue here: ESP32 + MAX485 breakout board. I can read the bus just fine and have the respective switches and sensors in HA... terrific! but trying to write a setting, either from the switch in HA or directly via mosquitto_pub, I can see the attempt on the RS-485 bus to send the cmd, but it doesnt successfully write the setting (or the controller ignores it).

One other thing worth noting, is out of the box the various pool devices (lights, air blower, edge pump, etc) are not mapped correctly: example - Air Blower is actually the Spa Light. Easy fix in HA itself to remap, but thought I'd mention it.

Here's a snippet where I was trying to turn some features on/off, to no avail:

I (79869) RS485_PENTAIR_CONTROLLER: Time:        14:33
I (79879) RS485_PENTAIR_CONTROLLER: Pump1:       on
I (79889) RS485_PENTAIR_CONTROLLER: Cleaner:     on
I (79889) RS485_PENTAIR_CONTROLLER: Air Blower:  off
I (79899) RS485_PENTAIR_CONTROLLER: Pool temp:   56
I (79899) RS485_PENTAIR_CONTROLLER: Spa temp:    56
I (79909) RS485_PENTAIR_CONTROLLER: Air temp:    54
I (79909) RS485_PENTAIR_CONTROLLER: Heater:      0
I (79919) RS485_PENTAIR_CONTROLLER: Heater mode: 0
I (79919) RS485_PENTAIR_CONTROLLER: Unknown:     4
I (79929) RS485_PENTAIR_CONTROLLER: Spa:         off
I (79939) RS485_PENTAIR_CONTROLLER: Pool light:  off
I (79939) RS485_PENTAIR_CONTROLLER: Spa light:   off

I (80319) RS485_PENTAIR_CONTROLLER: Received 9 bytes:
I (81079) RS485_PENTAIR_CONTROLLER: Received 6 bytes:
I (81459) RS485_PENTAIR_CONTROLLER: Received 14 bytes:
I (81869) RS485_PENTAIR_CONTROLLER: Received 11 bytes:
I (82009) RS485_PENTAIR_CONTROLLER: MQTT_EVENT_DATA
I (82009) RS485_PENTAIR_CONTROLLER: TOPIC='homeassistant/switch/pool/spa/set'

I (82009) RS485_PENTAIR_CONTROLLER: DATA='on'

I (82019) RS485_PENTAIR_CONTROLLER: Switching feature 01 ON **********************
I (82019) RS485_PENTAIR_CONTROLLER: Sending command from=20 to=10 command=86 feature=01 state=01
00 ff a5 1f 10 20 86 02 01 01 01 7e I (82219) RS485_PENTAIR_CONTROLLER: Received 12 bytes:
I (82219) RS485_PENTAIR_CONTROLLER: Found header start at offset 0
I (82219) RS485_PENTAIR_CONTROLLER: Source  : (0x10) Main
I (82229) RS485_PENTAIR_CONTROLLER: Dest    : (0x90) Unknown
I (82229) RS485_PENTAIR_CONTROLLER: Command : (0xd2) 210

I (82529) RS485_PENTAIR_CONTROLLER: 12
I (82629) RS485_PENTAIR_CONTROLLER: Received 3 bytes:
I (83099) RS485_PENTAIR_CONTROLLER: Received 5 bytes:
I (83509) RS485_PENTAIR_CONTROLLER: Received 47 bytes:
I (83509) RS485_PENTAIR_CONTROLLER: Found header start at offset 7
I (83509) RS485_PENTAIR_CONTROLLER: Source  : (0x10) Main
I (83509) RS485_PENTAIR_CONTROLLER: Dest    : (0x0f) Broadcast
I (83519) RS485_PENTAIR_CONTROLLER: Command : (0x02) 2

@michaelusner
Copy link
Owner

michaelusner commented Jan 3, 2023 via email

@jbishop129
Copy link

I am very interested in this being part of ESPHome!! A few years ago I had this working via an implementation of ser2net when I was on OpenHAB, but was not able to get it working again after I moved to Home Assistant. Very much agree this would be absolutely wonderful if it were part of ESPHome instead of a stand-alone project. Anything I can do to help, test, cheer on the efforts, I'm all-in on this direction.

Cheers

@rsumner
Copy link

rsumner commented Jan 3, 2023

I've contributed code for custom components to ESPHome in the past and happy to help here too. @michaelusner if you get a Github fork up and running and want some help, send over the details.

@michaelusner
Copy link
Owner

michaelusner commented Jan 3, 2023 via email

@michaelusner
Copy link
Owner

michaelusner commented Jan 3, 2023 via email

@jbishop129
Copy link

Any update on ESPHome?

@michaelusner
Copy link
Owner

michaelusner commented Mar 17, 2023 via email

@jbishop129
Copy link

Awesome, glad to hear this is still on the radar! I've been happily using your existing code on my pool for a few months, works great! Only issue that still remains (and I know you're aware of) is it doesnt seem to be able to write data to the pool bus, i.e. turn on the lights, turn on the heater, etc. Hopefully this issue goes away once it hits ESPhome!

@michaelusner
Copy link
Owner

michaelusner commented Apr 13, 2023 via email

@jbishop129
Copy link

Very sorry to hear about the lightening strike on your home :(

@npawelek
Copy link

I feel your pain about the lightning, and I'm sorry to hear that. We had a power outage during a storm last week and it knocked out our remote antenna (NO COMM and reattempting the address sync doesn't work). Instead of replacing I decided to give this a try.

After a bit of learning with esp-idf, I was able to get this connected to my EasyTouch panel. I can see the states, but I'm in the same boat as most of the others. Flipping a switch in home assistant does issue the set = on to the appropriate topic in MQTT, but the switch flips back to the off position shortly after being turned on.

@jbishop129
Copy link

Hi @michaelusner I hope your home and pool recovered well from the lightning strike! Have you made any progress with porting over to ESPhome? Happy to contribute in any way that’s helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants