ccutrer / balboa_worldwide_app

Ruby library for communication with Balboa Water Group's WiFi module or RS-485
92 stars 27 forks source link

Blower not working #52

Closed Chrone86 closed 2 years ago

Chrone86 commented 2 years ago

Hi If i try to set blower (homie/bwa/spa/blower/set), the service stopps with the following error: "W, Balboa MQTT Bridge running (version 1.3.0) W, from mqtt: "" at homie/bwa/spa/blower/set Traceback (most recent call last): 12: from /usr/local/bin/bwa_mqtt_bridge:23:in <main>' 11: from /usr/local/bin/bwa_mqtt_bridge:23:inload' 10: from /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/bin/bwa_mqtt_bridge:614:in <top (required)>' 9: from /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/bin/bwa_mqtt_bridge:614:innew' 8: from /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/bin/bwa_mqtt_bridge:149:in initialize' 7: from /usr/local/share/gems/gems/mqtt-0.5.0/lib/mqtt/client.rb:404:inget' 6: from /usr/local/share/gems/gems/mqtt-0.5.0/lib/mqtt/client.rb:435:in get_packet' 5: from /usr/local/share/gems/gems/mqtt-0.5.0/lib/mqtt/client.rb:435:inloop' 4: from /usr/local/share/gems/gems/mqtt-0.5.0/lib/mqtt/client.rb:437:in block in get_packet' 3: from /usr/local/share/gems/gems/mqtt-0.5.0/lib/mqtt/client.rb:405:inblock in get' 2: from /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/bin/bwa_mqtt_bridge:184:in block in initialize' 1: from /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/lib/bwa/client.rb:145:inset_blower' /usr/local/share/gems/gems/balboa_worldwide_app-1.3.0/lib/bwa/client.rb:145:in `-': false can't be coerced into Integer (TypeError)"

ccutrer commented 2 years ago

I'm pretty sure I already fixed this yesterday. Do you know how many speeds your blower has? Can your run the code from main, or do I need to release a new version of the gem for you to test it?

Chrone86 commented 2 years ago

The blower has only one speed, as my pumps have. I have no idea how to run the code from main, i installed it last time with gem

ccutrer commented 2 years ago

Okay, I just released v2.0.0 of the gem. šŸ¤ž it works for you. Note that it is a major release, as some of the properties have been renamed.

Chrone86 commented 2 years ago

If i try to start this release, i get the following error message:

Started with: /bwa_mqtt_bridge mqtt://mqtt-broker tcp://192.168.100.141

Traceback (most recent call last): 4: from /usr/local/bin/bwa_mqtt_bridge:23:in <main>' 3: from /usr/local/bin/bwa_mqtt_bridge:23:inload' 2: from /usr/local/share/gems/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:394:in <top (required)>' 1: from /usr/local/share/gems/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:394:innew' /usr/local/share/gems/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:45:in initialize': private methodhome_assistant_device=' called for #<MQTT::Homie::Device homie/bwa name="BWA Link", $state=:init> (NoMethodError)

ccutrer commented 2 years ago

Hmm. What version of Ruby are you using? You definitely got the new code running finally.

Chrone86 commented 2 years ago

ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]

Chrone86 commented 2 years ago

If I try with rvm ruby 3.0.3, i get this error: /usr/local/rvm/gems/ruby-3.0.3/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:206:in block in publish_basic_attributes': undefined methodzero?' for false:FalseClass (NoMethodError) from /usr/local/rvm/gems/ruby-3.0.3/gems/homie-mqtt-1.6.0/lib/mqtt/homie/device.rb:57:in block in node' from /usr/local/rvm/gems/ruby-3.0.3/gems/homie-mqtt-1.6.0/lib/mqtt/homie/device.rb:145:ininit' from /usr/local/rvm/gems/ruby-3.0.3/gems/homie-mqtt-1.6.0/lib/mqtt/homie/device.rb:53:in node' from /usr/local/rvm/gems/ruby-3.0.3/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:141:inpublish_basic_attributes' from /usr/local/rvm/gems/ruby-3.0.3/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:51:in initialize' from /usr/local/rvm/gems/ruby-3.0.3/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:394:innew' from /usr/local/rvm/gems/ruby-3.0.3/gems/balboa_worldwide_app-2.0.0/exe/bwa_mqtt_bridge:394:in `

'

ccutrer commented 2 years ago

šŸ‘

I'll look as soon as I can. The 3.0 stack trace looks like it might be a bug occurring because I don't have a blower to actually test with, but I should be able to figure it out.

The 2.5 stack trace is probably a Ruby 2.5-specific bug that I can also track down. I assume you're running on a Raspberry Pi? They really need to update their system Ruby. That's specifically why I (try to) maintain compatibility with 2.5, but it's so ancient!!

Anyhow, expect an update from me by Monday afternoon at the latest.

Chrone86 commented 2 years ago

Thank you very much. I also tried with 2.7.5 and got the same error as on 3.0.3 No, i'm running it on centos 8.

ccutrer commented 2 years ago

v2.0.1 was just published, which fixes both the Ruby 2.5 issue and reading blower status. Let me know how it goes. I haven't yet tested with Ruby 3.0, just waiting for it to compile.

ccutrer commented 2 years ago

Yup, looks like it's working just fine under 3.0 as well.

Chrone86 commented 2 years ago

thank you! Something still doesn't work as expected.

If i set 0,1 or 2 nothing happens. If i set true or false on "homie/bwa/spa/blower/set" then i get the following exception: W, Balboa MQTT Bridge running (version 2.0.1) Traceback (most recent call last): 7: from /usr/local/rvm/gems/ruby-2.7.5/gems/homie-mqtt-1.6.0/lib/mqtt/homie/device.rb:105:in block (2 levels) in publish' 6: from /usr/local/rvm/gems/ruby-2.7.5/gems/mqtt-ccutrer-1.0.1/lib/mqtt/client.rb:444:inget' 5: from /usr/local/rvm/gems/ruby-2.7.5/gems/mqtt-ccutrer-1.0.1/lib/mqtt/client.rb:444:in loop' 4: from /usr/local/rvm/gems/ruby-2.7.5/gems/mqtt-ccutrer-1.0.1/lib/mqtt/client.rb:458:inblock in get' 3: from /usr/local/rvm/gems/ruby-2.7.5/gems/homie-mqtt-1.6.0/lib/mqtt/homie/device.rb:116:in block (3 levels) in publish' 2: from /usr/local/rvm/gems/ruby-2.7.5/gems/homie-mqtt-1.6.0/lib/mqtt/homie/property.rb:171:inset' 1: from /usr/local/rvm/gems/ruby-2.7.5/gems/balboa_worldwide_app-2.0.1/exe/bwa_mqtt_bridge:223:in block (2 levels) in publish_basic_attributes' /usr/local/rvm/gems/ruby-2.7.5/gems/balboa_worldwide_app-2.0.1/lib/bwa/client.rb:193:inblower=': undefined method `-' for true:TrueClass (NoMethodError)

ccutrer commented 2 years ago

šŸ¤¦ . easy fix. but yeah, your single speed blower (and pumps if you have them) no longer accept 0, 1, and 2. Just true/false/toggle.

ccutrer commented 2 years ago

... but that is a good idea to still allow integer speeds. 2.0.4 allows that, with more intuitive conversions.

Chrone86 commented 2 years ago

Blower works now like a charm. Thank you for your support. At the moment i have to toggle the pumps with homie/bwa/spa/pump1/set 1 for on and off. Would it be possible to activate the pumps with true and deactivate with false? My pumps are single speed.

ccutrer commented 2 years ago

What's in MQTT at homie/bwa/spa/pump1/$format?

Chrone86 commented 2 years ago

the $format doesnt exist.. Looks like this for my balboa image

Chrone86 commented 2 years ago

By the way, I made some advertise for your plugin on a german loxone site https://loxwiki.atlassian.net/wiki/spaces/LOXBERRY/pages/1636466747/Balboa+Spa

ccutrer commented 2 years ago

hmmm, so the $dataype is boolean, so it is properly detecting a single speed pump. and I can't see any difference in the code between blower-that-is-boolean-or-multispeed vs. pump-that-is-boolean-or-multispeed. Your screenshot is a little confusing because homie/bwa/spa/pump1 should be false already since $datatype is boolean, but I'm fairly certain that's due to you setting "convert booleans to 1 and 0", since $settable is definitely going to be true and not 1. I'd still worry about that being an issue, except that you say the blower is working for you. So... I'm at a loss of what the problem is right now. I even tried forcing my spa to pretend it has a single-speed pump, and true/false are working just fine. I just released 2.0.5 that allows true/false to multi-speed things, but that shouldn't have any affect on you with a single/speed.

Chrone86 commented 2 years ago

i just disabled "convert booleans". The pump1 starts and stop now with true and 1.

Blower (true/false works): image

Light1 (true/false works): image

Pump1 (true and 1 works for start and stop) Start with true: image

Send false: image

Stop with true: image