Closed EmmanuelLM closed 3 years ago
Hey @EmmanuelLM,
I've not found the time yet to reinstall platformio so I can't verify the function, however, the code is looking really great. Thank you for your work!
I'll take the time the coming week and merge :-)
Cheers, Sascha
Hey @EmmanuelLM, Thank you very much for your efforts! I really like your additions and ideas. I've been testing it today using plain MQTT and it did work for me.
I'm having a litte struggle because of the HASS IO "inheritage" and the platform IO dependency.
Cheers, Sascha
Thanks Sascha, and thank you again for getting the ball rolling!
On Mon, 25 Jan 2021 at 17:18, Sascha notifications@github.com wrote:
Hey @EmmanuelLM https://github.com/EmmanuelLM, Thank you very much for your efforts! I really like your additions and ideas. I've been testing it today using plain MQTT and it did work for me.
I'm having a litte struggle because of the HASS IO "inheritage" and the platform IO dependency.
- As I'm pesonally am an openhab user, this is a little of a hurdle to me, but your structure seems logical and I'm willing to accept the structure. I'm just thinking of newbies, wanting to add their spa to nodered, openhab, scripts etc. - not home assistant. What do you think about this point?
- I've looked into the platform IO part of this. With newbies in the back of my head, I think there's a great add-on beside the effort to get the sketch compiled: Dependency resolution for the needed libraries. I really love this part! However, the point to get started it rather high. But maybe that may be fixable with a precompiled binary and WifiManager Hotspot?
Cheers, Sascha
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cribskip/esp8266_spa/pull/6#issuecomment-766973309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHW4H35UHUCBMI2JYEXGE3LS3WRXJANCNFSM4WDBEIMQ .
I really love your enthusiasm! I'll look into this this weekend :-)
@EmmanuelLM , I've looked into this and uploaded the sketch to my tub. Notably, I don't get f.e. messages to homeassistant/binary_sensor/Spa/state/config which I had configured in openhab to test this:
Watching the broker, there's no message either.
I've just changed the SSID, password, broker IP and HASSIO to true We should keep HASSIO enabled as default as HASSIO and openhab use this scheme 👍
Shouldn't the sketch send the config to the broker once the mqtt connection is established?
Sorry, I just have a short time window to try :-(
Hi Sacha, I have slightly changed the logic so that we only go to into the mqttpubsub sub-routine once we have the Spa configuration (have a look at the 'have_config' variable) - I wonder if this fails for you for some reason?
Do you get traffic on Spa/config/#?
Can you pick up the latest version from my repo as I have made a few more changes.
On Sun, 31 Jan 2021 at 07:54, Sascha notifications@github.com wrote:
@EmmanuelLM https://github.com/EmmanuelLM , I've looked into this and uploaded the sketch to my tub. Notably, I don't get f.e. messages to homeassistant/binary_sensor/Spa/state/config which I had configured in openhab to test this: [image: image] https://user-images.githubusercontent.com/1429498/106377793-d76b1080-639f-11eb-8065-a78c2f63531e.png
Watching the broker, there's no message either.
I've just changed the SSID, password, broker IP and HASSIO to true We should keep HASSIO enabled as default as HASSIO and openhab use this scheme 👍
Shouldn't the sketch send the config to the broker once the mqtt connection is established?
Sorry, I just have a short time window to try :-(
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cribskip/esp8266_spa/pull/6#issuecomment-770342557, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHW4H36CO5EKQJTA4C2WCS3S4UEEHANCNFSM4WDBEIMQ .
Hi @EmmanuelLM,
sadly, I don't get Spa/config messages. This is all I get using your current 0.30 code from your repo:
root@openhab2:/home/pi# mosquitto_sub -h openhab -t 'Spa/#' -v | ts
Feb 01 17:33:53 Spa/target_temp/state 30.00
Feb 01 17:33:53 Spa/time/state 17:43
Feb 01 17:33:53 Spa/heatingmode/state OFF
Feb 01 17:33:53 Spa/heatstate/state OFF
Feb 01 17:33:53 Spa/highrange/state ON
Feb 01 17:33:53 Spa/jet_1/state OFF
Feb 01 17:33:53 Spa/jet_2/state OFF
Feb 01 17:33:53 Spa/circ/state OFF
Feb 01 17:33:53 Spa/blower/state OFF
Feb 01 17:33:53 Spa/light/state OFF
Feb 01 17:33:53 Spa/relay_1/state OFF
Feb 01 17:33:53 Spa/relay_2/state OFF
Feb 01 17:33:53 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 01 17:34:15 Spa/target_temp/state 30.00
Feb 01 17:34:15 Spa/time/state 17:43
Feb 01 17:34:15 Spa/heatingmode/state OFF
Feb 01 17:34:15 Spa/heatstate/state OFF
Feb 01 17:34:15 Spa/highrange/state ON
Feb 01 17:34:15 Spa/jet_1/state OFF
Feb 01 17:34:15 Spa/jet_2/state OFF
Feb 01 17:34:15 Spa/circ/state OFF
Feb 01 17:34:15 Spa/blower/state OFF
Feb 01 17:34:15 Spa/light/state OFF
Feb 01 17:34:15 Spa/relay_1/state OFF
Feb 01 17:34:15 Spa/relay_2/state OFF
Feb 01 17:34:15 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 01 17:34:37 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 01 17:34:37 Spa/target_temp/state 30.00
Feb 01 17:34:37 Spa/time/state 17:44
Feb 01 17:34:37 Spa/heatingmode/state OFF
Feb 01 17:34:37 Spa/heatstate/state OFF
Feb 01 17:34:37 Spa/highrange/state ON
Feb 01 17:34:37 Spa/jet_1/state OFF
Feb 01 17:34:37 Spa/jet_2/state OFF
Feb 01 17:34:37 Spa/circ/state OFF
Feb 01 17:34:37 Spa/blower/state OFF
Feb 01 17:34:37 Spa/light/state OFF
Feb 01 17:34:37 Spa/relay_1/state OFF
Feb 01 17:34:37 Spa/relay_2/state OFF
Feb 01 17:34:57 Spa/target_temp/state 30.00
Feb 01 17:34:57 Spa/time/state 17:44
Feb 01 17:34:57 Spa/heatingmode/state OFF
Feb 01 17:34:57 Spa/heatstate/state OFF
Feb 01 17:34:57 Spa/highrange/state ON
Feb 01 17:34:57 Spa/jet_1/state OFF
Feb 01 17:34:57 Spa/jet_2/state OFF
Feb 01 17:34:57 Spa/circ/state OFF
Feb 01 17:34:57 Spa/blower/state OFF
Feb 01 17:34:57 Spa/light/state OFF
Feb 01 17:34:57 Spa/relay_1/state OFF
Feb 01 17:34:57 Spa/relay_2/state OFF
Feb 01 17:34:57 Spa/node/msg 7e 05 fe bf 00 ac 7e
I've enabled this line and tested again, Getting Config is never received: https://github.com/EmmanuelLM/esp8266_spa/blob/592f0b90d9c5e7da4ce47efeaa0b79c2a71c8f21/src/esp8266_spa.ino#L670
Feb 01 17:40:54 Spa/target_temp/state 30.00
Feb 01 17:40:54 Spa/time/state 17:50
Feb 01 17:40:54 Spa/heatingmode/state OFF
Feb 01 17:40:54 Spa/heatstate/state OFF
Feb 01 17:40:54 Spa/highrange/state ON
Feb 01 17:40:54 Spa/jet_1/state OFF
Feb 01 17:40:54 Spa/jet_2/state OFF
Feb 01 17:40:54 Spa/circ/state OFF
Feb 01 17:40:54 Spa/blower/state OFF
Feb 01 17:40:54 Spa/light/state OFF
Feb 01 17:40:54 Spa/relay_1/state OFF
Feb 01 17:40:54 Spa/relay_2/state OFF
Feb 01 17:40:54 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 01 17:41:14 Spa/target_temp/state 30.00
Feb 01 17:41:14 Spa/time/state 17:50
Feb 01 17:41:14 Spa/heatingmode/state OFF
Feb 01 17:41:14 Spa/heatstate/state OFF
Feb 01 17:41:14 Spa/highrange/state ON
Feb 01 17:41:14 Spa/jet_1/state OFF
Feb 01 17:41:14 Spa/jet_2/state OFF
Feb 01 17:41:14 Spa/circ/state OFF
Feb 01 17:41:14 Spa/blower/state OFF
Feb 01 17:41:14 Spa/light/state OFF
Feb 01 17:41:14 Spa/relay_1/state OFF
Feb 01 17:41:14 Spa/relay_2/state OFF
Feb 01 17:41:14 Spa/node/msg 7e 05 fe bf 00 ac 7e
I've look at the code and could not see a logic error, it should get an ID and see have_config is 0. Lines 662 and 663 look good to me.
Sadly, even inserting mqtt-dump-commands for the send variable, this is not printed (Line 653):
} else if (Q_in[2] == id) { // we have an ID, do clever stuff
if (Q_in[4] == 0x06) {
// id BF 06:Ready to Send
String tmp = "SEND: ";
tmp += String(send, HEX);
mqtt.publish("Spa/debug", String(tmp).c_str());
Do you think it's my spa? I've just noted there's also no Spa/node/id message... :-/
Cheers, Sascha
Hey Sascha, thanks for testing - I think it's more likely to be my programming!
It looks to me like the program never enters the subroutines to get the config [nor the fault log I presume?]
Are you compiling under Arduino or Platform IDE? if the former, I wonder if it doesn't recognise 'char' variables so might be worth declaring lines 72 -> 74 as uint8_t?
If that doesn't work, can you try inserting a mqtt debug message under 662 to see if we enter that subroutine? and then again in 670 and under 679 so we can check what subroutines are being ran?
P.S. "Spa/node/id" is linked to the above (as we only go into mqttpubsub when haveconfig == 2)
I'm sorry but the code never gets to line 663 and beyond on my site 😢 I'm compiling in platform IO so there should be no problem with this.
What balboa controller do you use to test? Maybe there's the difference, but I doubt as I dont get an ID with your code yet.
I don't think the controller is an issue to be honest... my PCB is also a BP2100G0.
The fact that you're not getting an ID makes me think it's something more fundamental.
Did you remember to set AUTO_TX to false? my RS485 to TTL doesn't need the D1 pin to be pulled low before transmit [you may for simplicity just override all the code involving AUTO_TX in the main program and balboa_helper] so this could explain why code does not get sent (nor received).
I just checked and I compiled with
#define AUTO_TX false //flag for the RS485/TTL chip - i.e. do we need to pull D1 or not....
so that seems to be right. I've also looked at the two locations where its being used - seems to be reasonable and right.
Even with power cycling my spa controller, I don't get any ID message :-(
I've removed the AUTO_TX ifs and no change. I've added a debug message when the id is requested and this got called. (Feb 02 15:51:50 Spa/node/id request)
So either there's no request being sent or the ID is not received. It works with my code, so there is a change which is preventing to get an ID.
My code added with the debug code to ID_request and ID_ack produces this:
Feb 02 15:55:30 Spa/msg 7e 05 fe bf 00 ac 7e
Feb 02 15:55:30 Spa/id request
Feb 02 15:55:30 Spa/msg 7e 08 fe bf 02 11 f1 73 9c 7e
Feb 02 15:55:30 Spa/id 17
Sadly, I did not find a possible breaking change causing this :-( Maybe we should skip all "handling" before getting an ID. Maybe its a timing issue?
Cheers, Sascha
PS: Good that we both have the same controller. Maybe they are on another firmware 🤔 What's your top panel? Mine is TP600.
That is so strange - I don't get why this might be happening... as the code looks fine.
Could you try knocking out line #597, #611 -> #624 and the AUTO_TX stuff then we are pretty much back to the original code. Could you also send me the result of those three lines for debug purposes in case it's a speed issue: mqtt.publish("Spa/node/flashsize", String(ESP.getFlashChipRealSize()).c_str()); mqtt.publish("Spa/node/chipid", String(ESP.getChipId()).c_str()); mqtt.publish("Spa/node/speed", String(ESP.getCpuFreqMHz()).c_str());
My suspicion is that the problem is linked to the code or the ESP hardware rather than the Balboa module because your code works fine on mine (and my new code works fine on mine as well) - let's see if we can figure it out!
I just don't get it either :-( I've checked out 0.31 and changed just the config in the header (SSID, Passwd, AUTO_TX was already set to false) and uploaded. Result:
# mosquitto_sub -h openhab -t 'Spa/#' -v | ts
Feb 03 06:55:32 Spa/node ON
Feb 03 06:55:52 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 06:56:14 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 06:56:36 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 06:56:58 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 06:57:18 Spa/node/msg 7e 05 fe bf 00 ac 7e
[repeating indef]
The first message is retained so please ignore that.
So I removed the AUTO_TX stuff and added again the "ID requested" message:
Feb 03 07:01:24 Spa/node ON
Feb 03 07:01:33 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 07:01:33 Spa/node/id requested
Feb 03 07:01:55 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 07:01:55 Spa/node/id requested
Feb 03 07:02:15 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 07:02:15 Spa/node/id requested
The code goes to ID request and appearently tries to send. As the controller is in the tub, I'll deploy the code on a spare wemos and debug there if it's really sending and report back :)
Cheers, Sascha
Ok, thank you. by the way please use 0.30 or 0.32 when I push it (there is a code regression in 0.31)
p.s. can you pop these somewhere where the code gets executed and let me know what values are returned?
mqtt.publish("Spa/node/flashsize", String(ESP.getFlashChipRealSize()).c_str()); mqtt.publish("Spa/node/chipid", String(ESP.getChipId()).c_str()); mqtt.publish("Spa/node/speed", String(ESP.getCpuFreqMHz()).c_str());
So I took 0.32 and adjusted AUTO_TX to false, added a debug for when ID request is sent and your requested infos:
# mosquitto_sub -h openhab -t 'Spa/#' -v | ts
Feb 03 18:11:51 Spa/node ON
Feb 03 18:12:15 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:12:15 Spa/node/flashsize 16777216
Feb 03 18:12:15 Spa/node/chipid 3967108
Feb 03 18:12:15 Spa/node/speed 80
Feb 03 18:12:15 Spa/node/id requested
Feb 03 18:12:37 Spa/node/msg 7e 05 fe bf 00 ac 7e
No ID is received.
I've enabled the message-dump in line 636:
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 20 ff af 13 00 01 ff 12 1b 01 26 03 06 03 04 00 00 00 00 00 00 00 02 00 3c 00 00 00 00 00 00 46 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:17:32 Spa/node/flashsize 16777216
Feb 03 18:17:32 Spa/node/chipid 3967108
Feb 03 18:17:32 Spa/node/speed 80
Feb 03 18:17:32 Spa/node/id requested
Feb 03 18:17:32 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:17:32 Spa/node/msg 7e 20 ff af 13 00 01 ff 12 1b 01 26 03 06 03 04 00 00 00 00 00 00 00 02 00 3c 00 00 00 00 00 00 46 7e
Feb 03 18:17:32 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:17:32 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
So no BF..02 message with a new ID. Contrary, I tried it with my code:
-->8--- SNIP
Feb 03 18:23:42 Spa/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:23:42 Spa/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:23:42 Spa/id request
Feb 03 18:23:42 Spa/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:23:42 Spa/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:23:42 Spa/msg 7e 08 fe bf 02 13 f1 73 4a 7e
Feb 03 18:23:42 Spa/msg 7e 08 fe bf 02 13 f1 73 4a 7e
Feb 03 18:23:42 Spa/id 19
Feb 03 18:23:42 Spa/msg 7e 05 11 bf 06 37 7e
Feb 03 18:23:42 Spa/msg 7e 16 13 bf 12 02 00 04 05 c 11 1b 3d 00 00 00 00 00 04 05 c 11 a2 7e
-->8--- SNIP
I immediatelly get an ID :-/
BTW We have to call httpServer.handle() more often as it causes the chip sometimes not to respond in time. I've simply added it to _yield().
I've stripped down the code to be timining sensitive as possible and close to mine, but I don't get an ID either :-( (Spa/node/id is from ID request simply to show it ran):
Feb 03 18:29:46 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:29:46 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 18:29:46 Spa/node/id 0
Feb 03 18:29:46 Spa/node/msg 7e 05 10 bf 06 5c 7e
Feb 03 18:29:46 Spa/node/msg 7e 07 10 bf 11 00 00 3e 7e
Feb 03 18:29:46 Spa/node/msg 7e 05 11 bf 06 37 7e
Feb 03 18:29:46 Spa/node/msg 7e 05 12 bf 06 8a 7e
Feb 03 18:29:46 Spa/node/msg 7e 05 13 bf 06 e1 7e
Maybe you can spot the difference. There's clearly no 7e 08 fe bf 02 13 f1 73 4a 7e after the ID request being received. Maybe my messages help out to spot the problem.
Cheers & keep up your good work! Sascha
Hi Sascha - it looks to me like the rs485_send() function is not working for some reason.... can you use your balboa_helper.ino to be sure?
I think I may have found the bug - have a look on line 69 of that file...
Let's say: BAM, you nailed it! Congratulations 🥳 I did always overscroll this comment :-(
Feb 03 19:28:51 Spa/node ON
Feb 03 19:29:16 Spa/node/msg 7e 05 fe bf 00 ac 7e
Feb 03 19:29:16 Spa/node/msg 7e 08 fe bf 02 16 f1 73 8a 7e
Feb 03 19:29:16 Spa/node/id 22
Feb 03 19:29:16 Spa/config/pumps1 1
Feb 03 19:29:16 Spa/config/pumps2 1
Feb 03 19:29:16 Spa/config/pumps3 0
Feb 03 19:29:16 Spa/config/pumps4 0
Feb 03 19:29:16 Spa/config/pumps5 0
Feb 03 19:29:16 Spa/config/pumps6 0
Feb 03 19:29:16 Spa/config/light1 1
Feb 03 19:29:16 Spa/config/light2 0
Feb 03 19:29:16 Spa/config/circ 1
Feb 03 19:29:16 Spa/config/blower 1
Feb 03 19:29:16 Spa/config/mister 0
Feb 03 19:29:16 Spa/config/aux1 0
Feb 03 19:29:16 Spa/config/aux2 0
Feb 03 19:29:16 Spa/state ON
Feb 03 19:29:16 Spa/node/debug RECONNECT
Feb 03 19:29:16 Spa/node/version 0.32
Feb 03 19:29:16 Spa/node/flashsize 16777216
Feb 03 19:29:16 Spa/node/chipid 3967108
Feb 03 19:29:16 Spa/node/speed 80
Feb 03 19:29:16 Spa/target_temp/state 30.00
Feb 03 19:29:16 Spa/temperature/state 29.00
Feb 03 19:29:16 Spa/time/state 19:39
Feb 03 19:29:16 Spa/heatingmode/state OFF
Feb 03 19:29:16 Spa/heatstate/state OFF
Feb 03 19:29:16 Spa/highrange/state ON
Feb 03 19:29:16 Spa/jet_1/state OFF
Feb 03 19:29:16 Spa/jet_2/state OFF
Feb 03 19:29:16 Spa/circ/state OFF
Feb 03 19:29:16 Spa/blower/state OFF
Feb 03 19:29:16 Spa/light/state OFF
Feb 03 19:29:16 Spa/relay_1/state OFF
Feb 03 19:29:16 Spa/relay_2/state OFF
Feb 03 19:29:16 Spa/fault/Entries 24
Feb 03 19:29:16 Spa/fault/Entry 23
Feb 03 19:29:16 Spa/fault/Code 19
Feb 03 19:29:16 Spa/fault/Message Priming Mode
Feb 03 19:29:16 Spa/fault/DaysAgo 2
Feb 03 19:29:16 Spa/fault/Hours 15
Feb 03 19:29:16 Spa/fault/Minutes 55
Yay!!!! thank you for your help debugging that silly code! Glad to see it is working for you :)
Hi, as promised here is the pull request - sorry it is large! Biggest changes are as follows:
I have started work on pulling more information from the Spa and (eventually) making it auto-configure (i.e. it will only expose the MQTT topics based on the configuration).