liaan / broadlink_ac_mqtt

Broadlink Air Conditioners to mqtt
MIT License
101 stars 43 forks source link

Critical error on monitor start #64

Closed fmobile999 closed 2 years ago

fmobile999 commented 3 years ago

Hi! I got error on monitor start:

2020-12-20 00:36:15,890,890 INFO     [monitor.py:321] Starting Monitor...
2020-12-20 00:36:15,950,950 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'
2020-12-20 00:36:15,951,951 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'
2020-12-20 00:36:15,952,952 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'
2020-12-20 00:36:15,952,952 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'
2020-12-20 00:36:15,953,953 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'
2020-12-20 00:36:15,953,953 CRITICAL [AcToMqtt.py:112] unsupported operand type(s) for +: 'NoneType' and 'int'

Apparently, the error occurs in the place AcToMqtt.py:92 - "self.last_update[key] + self.config["update_interval"]" due to missing self.last_update[key]

Same error occurs on docker version.

System Raspberry Pi 3B Linux MYHOME 5.10.1-v7+ #1383 SMP Fri Dec 18 19:02:15 GMT 2020 armv7l GNU/Linux PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)"

config:

service:
    daemon_mode: True
    update_interval: 10
    self_discovery: False
mqtt:
    host: localhost
    port: 1883
    client_id: acmqtt
    user: mqttuser
    passwd: password
    topic_prefix: /aircon
    auto_discovery_topic: homeassistant
    auto_discovery_topic_retain: False
    discovery: False
##Devices
devices:
- ip: 192.168.1.233
  mac: a043b2266cb4
  name: ballu
  port: 80

The question is - what am I doing wrong?

fmobile999 commented 3 years ago

UPD: on OpenWrt 19.07.1 r10911-c155900f66 / LuCI openwrt-19.07 branch git-20.029.45734-adbbd5c same error.

LordDethman commented 3 years ago

I am having the same error here. My Home assistant did create the device but it does not appear to update or take any commands after that. I am running an AUX ASW-H12U3 air conditioner. I wish I was good enough with Python to try and resolve the issue but alas I am not. Most I can do is give as much information as I can.

OS Info:

NAME="Ubuntu" VERSION="20.10 (Groovy Gorilla)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.10" VERSION_ID="20.10" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=groovy UBUNTU_CODENAME=groovy

Config.yml: ` service: daemon_mode: True update_interval: 10 self_discovery: False

mqtt: host: 10.0.1.75 port: 1883 client_id: ac_to_mqtt user: **** passwd: **** topic_prefix: /hvac auto_discovery_topic: homeassistant auto_discovery_topic_retain: False discovery: False

Devices

devices:

liaan commented 3 years ago

You guys still having this issue?

LordDethman commented 3 years ago

liaan Yes I know I am stilling having this issue. Any assistance you be great. If there is something else you want me to pull please let me know.

liaan commented 3 years ago

liaan Yes I know I am stilling having this issue. Any assistance you be great. If there is something else you want me to pull please let me know.

What python version you running?

LordDethman commented 3 years ago

liaan Yes I know I am stilling having this issue. Any assistance you be great. If there is something else you want me to pull please let me know.

What python version you running?

On my Virtual Machine I am running Python 3.8.6, I also tried to get it to run under Python 2.7.18 but was unable to get it to run at all under Python 2.

The docker is reporting Python 2.7.18 as well.

LordDethman commented 3 years ago

liaan Yes I know I am stilling having this issue. Any assistance you be great. If there is something else you want me to pull please let me know.

What python version you running?

On my Virtual Machine I am running Python 3.8.6, I also tried to get it to run under Python 2.7.18 but was unable to get it to run at all under Python 2.

The docker is reporting Python 2.7.18 as well.

Ok I was able to get it to run under Python 2.7.18 on my Ubuntu VM. Running Python ./monitor.py -S give me the output as expected. Because my AUX Units report no name I am using the manual config as stated on the github page with self_discovery: False.

Here is a copy of the log file

log.txt

liaan commented 3 years ago

Can you please isntall latest version (yesterday) , then run monitor.py -d and sent me copy of the ../log/out.log file ... (and any output from the console).

Its written to work 100% on python 2 and 3 ... so not sure why not working.

LordDethman commented 3 years ago

Ok I re-cloned the rep. Ran everything again. I am getting the same errors. I also tried re-composing the docker and get the same results. This is on a Virtual Machine so if there is a Distro other than Ubuntu you would like me to try let me know.

I tried running with both Python 2.7.18 and Python 3.8.6. Got the same response. Had to force quit the operation.

OS:

'NAME="Ubuntu" VERSION="20.10 (Groovy Gorilla)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.10" VERSION_ID="20.10" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=groovy UBUNTU_CODENAME=groovy ' config.yml:

`service: daemon_mode: True update_interval: 15 self_discovery: False

mqtt: host: homeassistant.olympus.dethman69.no-ip.biz port: 1883 client_id: ac_to_mqtt user: dethman passwd: deth6969 topic_prefix: /HVAC auto_discovery_topic: homeassistant auto_discovery_topic_retain: False discovery: False

Devices

devices:

` 2021-01-20 18:07:51,056,56 DEBUG [monitor.py:273] ./monitor.py v1.0.17 is starting up 2021-01-20 18:07:51,056,56 DEBUG [monitor.py:275] Loglevel set to DEBUG 2021-01-20 18:07:51,075,75 INFO [monitor.py:322] Starting Monitor... 2021-01-20 18:07:51,076,76 DEBUG [monitor.py:324] Starting mainloop, responding on only events 2021-01-20 18:07:51,078,78 DEBUG [AcToMqtt.py:285] Coneccting to MQTT: homeassistant.olympus.dethman69.no-ip.biz with client ID = ac_to_mqtt 2021-01-20 18:07:51,093,93 DEBUG [ac_db.py:325] Debugging Enabled 2021-01-20 18:07:51,093,93 DEBUG [ac_db.py:329] Authenticating 2021-01-20 18:07:51,094,94 DEBUG [AcToMqtt.py:449] Mqtt connected! client=<paho.mqtt.client.Client object at 0x7ffba0aee890>, userdata=None, flags={'s> 2021-01-20 18:07:51,094,94 DEBUG [AcToMqtt.py:454] Listing on /HVAC/+/+/set for messages 2021-01-20 18:07:51,094,94 DEBUG [AcToMqtt.py:256] publishing on topic "/HVAC/LWT", data "online" 2021-01-20 18:07:51,100,100 DEBUG [ac_db.py:325] Debugging Enabled 2021-01-20 18:07:51,100,100 DEBUG [ac_db.py:329] Authenticating 2021-01-20 18:07:51,103,103 DEBUG [AcToMqtt.py:202] HA config Retain set to: False 2021-01-20 18:07:51,103,103 DEBUG [AcToMqtt.py:256] publishing on topic "homeassistant/climate/24dfa7e2837d/config", data "{"current_temperature_topic> 2021-01-20 18:07:51,104,104 DEBUG [AcToMqtt.py:256] publishing on topic "homeassistant/climate/24dfa7e2887c/config", data "{"current_temperature_topic> 2021-01-20 18:07:51,104,104 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:51,105,105 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:51,105,105 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:51,106,106 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:51,111,111 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int'

2021-01-20 18:07:51,999,999 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:51,999,999 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,000,0 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,001,1 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,001,1 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,002,2 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,002,2 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,003,3 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,003,3 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,004,4 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,004,4 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,005,5 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,005,5 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,005,5 CRITICAL [AcToMqtt.py:114] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-20 18:07:52,006,6 INFO [monitor.py:159] Stopping 2021-01-20 18:07:52,007,7 INFO [monitor.py:159] Stopping

`

LordDethman commented 3 years ago

In case this helps with anything as well:

dethman@actomqtt:~/broadlink_ac_mqtt$ ./monitor.py -S *** start copy below **** devices:

*** stop copy above ****

liaan commented 3 years ago

your setup with same python works 100% on my sistem ... grr

I added some more debugging .. can you just git pull latest and do the monitor.py -d and paste out.log again please. It should spit out the devices configured now, maybe its not creating the device array properly..

liaan commented 3 years ago

mmmm ... let me just check something else .. seems like it sfailing before where I thought it was

liaan commented 3 years ago

Ok, added traceback on the error logging, hopefully we can figure where its failling now

can you please pull latest .. should be 1.0.18 (./monitor.py -v) .

LordDethman commented 3 years ago

Hmm this is strange. Now I can run ./monitor.py -S and it spits out the AC Units. However, once I run ./monitor.py -d it just goes to the next line and does not appear to run after that. Once I run ./monitor.py -d the only way I can get it to actually run is to reboot the machine.

Otherwise it is the same error. I am going to rebuild the VM since I have messed with so much I want to start with a clean state. I am also going to try Ubuntu 18.04 rather than Ubuntu 20.10. I have some other VMs that for whatever reason the newer version caused issues. I will post the results after everything is done installing and tests ran.

liaan commented 3 years ago

ok .. jsut check the log/out.log .. might be that PID file is not getting removed properly you can try delete /tmp/ac_to_mqtt.pid .. this is the PID file to prevent duplicate monitor.py processes ..

Just upload the output of log/out.log please .. the tracestack should be in there where it fails..

L:

LordDethman commented 3 years ago

Ok so under Ubuntu 18.04 the ./monitor.py -S looks different. It also looks like I got some different out.log. I attached the out.log file in text. I am not the best with linux so for the life of me can never get samba working correctly so that I can just pull the whole file out for you. Let me know if this helps or you want me to try something else.

*** start copy below **** devices:

*** stop copy above ****

log.txt

fmobile999 commented 3 years ago

Hi, liaan! Thank you for attention.

I reinstalled the system to a clean raspbian and got the same result:

2021-01-21 22:21:47,821,821 DEBUG [monitor.py:278] ./monitor.py v1.0.18 is starting up 2021-01-21 22:21:47,822,822 DEBUG [monitor.py:280] Loglevel set to DEBUG 2021-01-21 22:21:47,842,842 INFO [monitor.py:327] Starting Monitor... 2021-01-21 22:21:47,843,843 DEBUG [monitor.py:329] Starting mainloop, responding on only events 2021-01-21 22:21:47,845,845 DEBUG [AcToMqtt.py:290] Coneccting to MQTT: localhost with client ID = ac_to_mqtt 2021-01-21 22:21:47,850,850 DEBUG [ac_db.py:325] Debugging Enabled 2021-01-21 22:21:47,850,850 DEBUG [ac_db.py:329] Authenticating 2021-01-21 22:21:47,856,856 DEBUG [AcToMqtt.py:207] HA config Retain set to: False 2021-01-21 22:21:47,857,857 DEBUG [AcToMqtt.py:261] publishing on topic "homeassistant/climate/a043b0088cb8/config", data "{"current_temperature_topic": "/aircon/a043b0088cb8/ambient_temp/value", "fan_mode_command_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/set", "pl_avail": "online", "name": "ballu", "action_topic": "/aircon/a043b0088cb8/homeassistant/set", "mode_state_topic": "/aircon/a043b0088cb8/mode_homeassistant/value", "precision": 0.5, "fan_modes": ["Auto", "Low", "Medium", "High", "Turbo", "Mute"], "temp_step": 0.5, "temperature_state_topic": "/aircon/a043b0088cb8/temp/value", "min_temp": 16.0, "pl_not_avail": "offline", "temperature_command_topic": "/aircon/a043b0088cb8/temp/set", "device": {"model": "Aircon", "mf": "Broadlink", "sw": "1.1.2", "ids": "a043b0088cb8", "name": "ballu"}, "mode_command_topic": "/aircon/a043b0088cb8/mode_homeassistant/set", "availability_topic": "/aircon/LWT", "max_temp": 32.0, "fan_mode_state_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/value", "unique_id": "a043b0088cb8", "modes": ["off", "cool", "heat", "fan_only", "dry"]}" 2021-01-21 22:21:47,858,858 DEBUG [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x761c4148>} 2021-01-21 22:21:47,858,858 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-21 22:21:47,861,861 DEBUG [AcToMqtt.py:119] Traceback (most recent call last): File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start status = device.get_ac_status() File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 340, in get_ac_status if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) : TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2021-01-21 22:21:47,862,862 DEBUG [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x761c4148>} 2021-01-21 22:21:47,863,863 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-21 22:21:47,863,863 DEBUG [AcToMqtt.py:119] Traceback (most recent call last): File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start status = device.get_ac_status() File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 340, in get_ac_status if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) : TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2021-01-21 22:21:47,864,864 DEBUG [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x761c4148>} 2021-01-21 22:21:47,864,864 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int' 2021-01-21 22:21:47,865,865 DEBUG [AcToMqtt.py:119] Traceback (most recent call last): File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start status = device.get_ac_status() File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 340, in get_ac_status if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) : TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

abd ad infinitum...

that is, it looks like the script is not getting the last update time.

"./monitor.py -S" works fine.

P.S. python3 - the same error.

fmobile999 commented 3 years ago

P.P.S. the problem with the PID periodically occurs, it is solved by deleting the PID file

fmobile999 commented 3 years ago

Maybe, some python packages do not installed on raspbian?

pip list Package Version


asn1crypto 0.24.0 atomicwrites 1.4.0 attrs 20.3.0 backports.functools-lru-cache 1.6.1 configparser 3.5.0b2 contextlib2 0.6.0.post1 cryptography 2.6.1 DateTime 4.3 entrypoints 0.3 enum34 1.1.6 flake8 3.8.4 funcsigs 1.0.2 functools32 3.2.3.post2 importlib-metadata 2.1.1 ipaddress 1.0.17 keyring 17.1.1 keyrings.alt 3.1.1 mccabe 0.6.1 more-itertools 5.0.0 packaging 20.8 paho-mqtt 1.5.1 pathlib2 2.3.5 pip 18.1 pluggy 0.13.1 py 1.10.0 pycodestyle 2.6.0 pycrypto 2.6.1 pyflakes 2.2.0 PyGObject 3.30.4 pyparsing 2.4.7 pytest 4.6.11 pytz 2020.5 pyxdg 0.25 PyYAML 5.3.1 RPi.GPIO 0.7.0 scandir 1.10.0 SecretStorage 2.3.1 setuptools 40.8.0 six 1.12.0 typing 3.7.4.3 wcwidth 0.2.5 wheel 0.32.3 zipp 1.2.0 zope.interface 5.2.0

fmobile999 commented 3 years ago

P.P.P.S. Problem with the PID occurs after ./monitor.py -S, file dont deleted after command finished.

liaan commented 3 years ago

Thanks ... I see there is a issue now with the PID logic .. .i'm fixing that now.

I see the issue is on line 340 yes ... Very weird , there must be failure before causing the last update not to get set. Will add some more debugging

liaan commented 3 years ago

ok.. moved PID check to better place so loggnig works and hopefully give more insites into PID issue

It seems like its not liking the response from the AC, either that or not able to connect. I've added more debuging, can you pull latest and run monitor.py -d and dump the log/out.log again please.

fmobile999 commented 3 years ago
2021-01-22 12:36:11,046,46 DEBUG    [monitor.py:278] ./monitor.py v1.0.18 is starting up
2021-01-22 12:36:11,047,47 DEBUG    [monitor.py:280] Loglevel set to DEBUG
2021-01-22 12:36:11,068,68 DEBUG    [monitor.py:133] Checking if already running
2021-01-22 12:36:11,069,69 INFO     [monitor.py:332] Starting Monitor...
2021-01-22 12:36:11,069,69 DEBUG    [monitor.py:334] Starting mainloop, responding on only events
2021-01-22 12:36:11,071,71 DEBUG    [AcToMqtt.py:290] Coneccting to MQTT: localhost with client ID = ac_to_mqtt
2021-01-22 12:36:11,080,80 DEBUG    [ac_db.py:325] Debugging Enabled
2021-01-22 12:36:11,080,80 DEBUG    [ac_db.py:329] Authenticating
2021-01-22 12:36:11,088,88 DEBUG    [AcToMqtt.py:207] HA config Retain set to: False
2021-01-22 12:36:11,088,88 DEBUG    [AcToMqtt.py:261] publishing on topic "homeassistant/climate/a043b0088cb8/config", data "{"current_temperature_topic": "/aircon/a043b0088cb8/ambient_temp/value", "fan_mode_command_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/set", "pl_avail": "online", "name": "ballu", "action_topic": "/aircon/a043b0088cb8/homeassistant/set", "mode_state_topic": "/aircon/a043b0088cb8/mode_homeassistant/value", "precision": 0.5, "fan_modes": ["Auto", "Low", "Medium", "High", "Turbo", "Mute"], "temp_step": 0.5, "temperature_state_topic": "/aircon/a043b0088cb8/temp/value", "min_temp": 16.0, "pl_not_avail": "offline", "temperature_command_topic": "/aircon/a043b0088cb8/temp/set", "device": {"model": "Aircon", "mf": "Broadlink", "sw": "1.1.2", "ids": "a043b0088cb8", "name": "ballu"}, "mode_command_topic": "/aircon/a043b0088cb8/mode_homeassistant/set", "availability_topic": "/aircon/LWT", "max_temp": 32.0, "fan_mode_state_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/value", "unique_id": "a043b0088cb8", "modes": ["off", "cool", "heat", "fan_only", "dry"]}"
2021-01-22 12:36:11,089,89 DEBUG    [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x7608d530>}
2021-01-22 12:36:11,090,90 DEBUG    [ac_db.py:342] Last update was: None
2021-01-22 12:36:11,091,91 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int'
2021-01-22 12:36:11,092,92 DEBUG    [AcToMqtt.py:119] Traceback (most recent call last):
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start
    status = device.get_ac_status()
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 344, in get_ac_status
    if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2021-01-22 12:36:11,093,93 DEBUG    [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x7608d530>}
2021-01-22 12:36:11,093,93 DEBUG    [ac_db.py:342] Last update was: None
2021-01-22 12:36:11,094,94 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int'
2021-01-22 12:36:11,094,94 DEBUG    [AcToMqtt.py:119] Traceback (most recent call last):
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start
    status = device.get_ac_status()
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 344, in get_ac_status
    if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Sorry, I forgot to say important: i have Ballu BSUI-18, not 12. They write on the Internet that 12 and 18 have the same control system, but they write a lot on the Internet

liaan commented 3 years ago

Sorry, can you please pull again and test ... I see might be failing on the Auth part.

you can also, if you want , try and comment out the auth lines in ac_db.py line 330-332 and see makes any difference

fmobile999 commented 3 years ago
2021-01-22 13:03:58,679,679 DEBUG    [monitor.py:278] ./monitor.py v1.0.18 is starting up
2021-01-22 13:03:58,680,680 DEBUG    [monitor.py:280] Loglevel set to DEBUG
2021-01-22 13:03:58,700,700 DEBUG    [monitor.py:133] Checking if already running
2021-01-22 13:03:58,701,701 INFO     [monitor.py:332] Starting Monitor...
2021-01-22 13:03:58,701,701 DEBUG    [monitor.py:334] Starting mainloop, responding on only events
2021-01-22 13:03:58,703,703 DEBUG    [AcToMqtt.py:290] Coneccting to MQTT: localhost with client ID = ac_to_mqtt
2021-01-22 13:03:58,709,709 DEBUG    [AcToMqtt.py:454] Mqtt connected! client=<paho.mqtt.client.Client object at 0x7619c830>, userdata=None, flags={'session present': 0}, rc=0
2021-01-22 13:03:58,711,711 DEBUG    [AcToMqtt.py:459] Listing on /aircon/+/+/set for messages
2021-01-22 13:03:58,711,711 DEBUG    [ac_db.py:325] Debugging Enabled
2021-01-22 13:03:58,711,711 DEBUG    [AcToMqtt.py:261] publishing on topic "/aircon/LWT", data "online"
2021-01-22 13:03:58,712,712 DEBUG    [ac_db.py:329] Authenticating
2021-01-22 13:03:58,719,719 CRITICAL [ac_db.py:331] Authentication Failed to AC
2021-01-22 13:03:58,720,720 DEBUG    [AcToMqtt.py:207] HA config Retain set to: False
2021-01-22 13:03:58,721,721 DEBUG    [AcToMqtt.py:261] publishing on topic "homeassistant/climate/a043b0088cb8/config", data "{"current_temperature_topic": "/aircon/a043b0088cb8/ambient_temp/value", "fan_mode_command_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/set", "pl_avail": "online", "name": "ballu", "action_topic": "/aircon/a043b0088cb8/homeassistant/set", "mode_state_topic": "/aircon/a043b0088cb8/mode_homeassistant/value", "precision": 0.5, "fan_modes": ["Auto", "Low", "Medium", "High", "Turbo", "Mute"], "temp_step": 0.5, "temperature_state_topic": "/aircon/a043b0088cb8/temp/value", "min_temp": 16.0, "pl_not_avail": "offline", "temperature_command_topic": "/aircon/a043b0088cb8/temp/set", "device": {"model": "Aircon", "mf": "Broadlink", "sw": "1.1.2", "ids": "a043b0088cb8", "name": "ballu"}, "mode_command_topic": "/aircon/a043b0088cb8/mode_homeassistant/set", "availability_topic": "/aircon/LWT", "max_temp": 32.0, "fan_mode_state_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/value", "unique_id": "a043b0088cb8", "modes": ["off", "cool", "heat", "fan_only", "dry"]}"
2021-01-22 13:03:58,722,722 DEBUG    [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x76057580>}
2021-01-22 13:03:58,723,723 DEBUG    [ac_db.py:343] Last update was: None
2021-01-22 13:03:58,723,723 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int'
2021-01-22 13:03:58,725,725 DEBUG    [AcToMqtt.py:119] Traceback (most recent call last):
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start
    status = device.get_ac_status()
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 345, in get_ac_status
    if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

2021-01-22 13:03:58,726,726 DEBUG    [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x76057580>}
2021-01-22 13:03:58,726,726 DEBUG    [ac_db.py:343] Last update was: None
2021-01-22 13:03:58,726,726 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int'
2021-01-22 13:03:58,727,727 DEBUG    [AcToMqtt.py:119] Traceback (most recent call last):
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start
    status = device.get_ac_status()
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 345, in get_ac_status
    if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
liaan commented 3 years ago

Auth is failing. Wonder if needs different auth packet or just not auth at all..

2021-01-22 13:03:58,712,712 DEBUG    [ac_db.py:329] Authenticating
2021-01-22 13:03:58,719,719 CRITICAL [ac_db.py:331] Authentication Failed to AC

You by any change know anything about either wireshark or android debugging .. cause I need the to see traffic from/to device to device to see what is different...

L:

fmobile999 commented 3 years ago

In the evening I will read about wireshark and start job. We need traffic from AC to AC Freedom Cloud?

liaan commented 3 years ago

In the evening I will read about wireshark and start job. We need traffic from AC to AC Freedom Cloud?

If you have android app .. then from android to the AC. I cannot remmember what cloud traffic looks like, been ages.

If you have android studio installed, you might be able to see the debugging info from the android app as well.

Not sure how you curentley controlling the ac's .. so guessing a bit ;-)

fmobile999 commented 3 years ago

Android (AC Freedom) working only.

liaan commented 3 years ago

Android (AC Freedom) working only.

Some of the old AC freedom apps leak alot of debugging info , 1.2.28 , 1.0.27 if I recall (need to download APK and install manully). So if you plug phone into pc and start android studio and just keep debugging window open, you can see tons of debugging .

Don't know if that might give us some more info

Did you try and run the script without the Auth part?

fmobile999 commented 3 years ago

Did you try and run the script without the Auth part?

Yes, how i can do it?

liaan commented 3 years ago

Did you try and run the script without the Auth part?

Yes, how i can do it?

in file ac_db.py , comment out (#) lines 330-332

fmobile999 commented 3 years ago
2021-01-22 13:27:23,678,678 DEBUG    [monitor.py:278] ./monitor.py v1.0.18 is starting up
2021-01-22 13:27:23,679,679 DEBUG    [monitor.py:280] Loglevel set to DEBUG
2021-01-22 13:27:23,701,701 DEBUG    [monitor.py:133] Checking if already running
2021-01-22 13:27:23,703,703 INFO     [monitor.py:332] Starting Monitor...
2021-01-22 13:27:23,703,703 DEBUG    [monitor.py:334] Starting mainloop, responding on only events
2021-01-22 13:27:23,705,705 DEBUG    [AcToMqtt.py:290] Coneccting to MQTT: localhost with client ID = ac_to_mqtt
2021-01-22 13:27:23,711,711 DEBUG    [ac_db.py:325] Debugging Enabled
2021-01-22 13:27:23,712,712 DEBUG    [ac_db.py:329] Authenticating
2021-01-22 13:27:23,713,713 DEBUG    [ac_db.py:334] Getting current details in init
2021-01-22 13:27:23,714,714 DEBUG    [ac_db.py:343] Last update was: None
2021-01-22 13:27:23,714,714 DEBUG    [ac_db.py:349] Getting AC Info
2021-01-22 13:27:23,721,721 DEBUG    [ac_db.py:583] Invalid packet received Errorcode 65529
2021-01-22 13:27:23,722,722 DEBUG    [ac_db.py:584] Failed Raw Response: 01011010 10100101 10101010 01010101 01011010 10100101 10101010 01010101 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 10000111 11001010 11111001 11111111 00101010 01001110 11101110 00000011 00000000 00100011 10100000 01000011 10110000 00001000 10001100 10111000 00000000 00000000 00000000 00000000 10111001 11000000 00000000 00000000
2021-01-22 13:27:23,722,722 DEBUG    [ac_db.py:351] AC Info Retrieved
2021-01-22 13:27:23,723,723 DEBUG    [ac_db.py:353] Getting AC States
2021-01-22 13:27:23,723,723 DEBUG    [ac_db.py:595] Last update was: None
2021-01-22 13:27:23,726,726 DEBUG    [ac_db.py:355] AC States retrieved
2021-01-22 13:27:23,726,726 DEBUG    [AcToMqtt.py:207] HA config Retain set to: False
2021-01-22 13:27:23,727,727 DEBUG    [AcToMqtt.py:261] publishing on topic "homeassistant/climate/a043b0088cb8/config", data "{"current_temperature_topic": "/aircon/a043b0088cb8/ambient_temp/value", "fan_mode_command_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/set", "pl_avail": "online", "name": "ballu", "action_topic": "/aircon/a043b0088cb8/homeassistant/set", "mode_state_topic": "/aircon/a043b0088cb8/mode_homeassistant/value", "precision": 0.5, "fan_modes": ["Auto", "Low", "Medium", "High", "Turbo", "Mute"], "temp_step": 0.5, "temperature_state_topic": "/aircon/a043b0088cb8/temp/value", "min_temp": 16.0, "pl_not_avail": "offline", "temperature_command_topic": "/aircon/a043b0088cb8/temp/set", "device": {"model": "Aircon", "mf": "Broadlink", "sw": "1.1.2", "ids": "a043b0088cb8", "name": "ballu"}, "mode_command_topic": "/aircon/a043b0088cb8/mode_homeassistant/set", "availability_topic": "/aircon/LWT", "max_temp": 32.0, "fan_mode_state_topic": "/aircon/a043b0088cb8/fanspeed_homeassistant/value", "unique_id": "a043b0088cb8", "modes": ["off", "cool", "heat", "fan_only", "dry"]}"
2021-01-22 13:27:23,728,728 DEBUG    [AcToMqtt.py:87] Following devices configured {'a043b0088cb8': <ac_db.ac_db instance at 0x76107508>}
2021-01-22 13:27:23,728,728 DEBUG    [ac_db.py:343] Last update was: None
2021-01-22 13:27:23,729,729 CRITICAL [AcToMqtt.py:118] unsupported operand type(s) for +: 'NoneType' and 'int'
2021-01-22 13:27:23,731,731 DEBUG    [AcToMqtt.py:119] Traceback (most recent call last):
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/AcToMqtt.py", line 107, in start
    status = device.get_ac_status()
  File "/root/broadlink_ac_mqtt/broadlink_ac_mqtt/classes/broadlink/ac_db.py", line 345, in get_ac_status
    if (force_update == False and (self.status['lastupdate'] + self.update_interval) > time.time()) :
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
liaan commented 3 years ago

If you can do basic python ..Is it possible that you can test this library: https://github.com/mjg59/python-broadlink ?

you can follow: https://github.com/mjg59/python-broadlink/tree/master/cli

If that library gets passed the auth part, then need to dig deeper....

fmobile999 commented 3 years ago

I'll try it at evening. Thank you. Need you sniffed network traffic data?

liaan commented 3 years ago

I'll try it at evening. Thank you. Need you sniffed network traffic data?

If you able to get that, it will be great

fmobile999 commented 3 years ago
./broadlink_discovery --dst-ip 192.168.1.233
Discovering...
Traceback (most recent call last):
  File "./broadlink_discovery", line 16, in <module>
    if device.auth():
  File "/usr/local/lib/python3.7/dist-packages/broadlink/device.py", line 198, in auth
    check_error(response[0x22:0x24])
  File "/usr/local/lib/python3.7/dist-packages/broadlink/exceptions.py", line 137, in check_error
    raise exception(error_code)
broadlink.exceptions.AuthenticationError: [Errno -1] Authentication failed

Sorry for stupid question - should these manipulations be carried out in AP mode, or with AC Freedom connected? And manipulations with ./monitor.py ? Maybe AC Freedom is interfering with authentication?

liaan commented 3 years ago
./broadlink_discovery --dst-ip 192.168.1.233
Discovering...
Traceback (most recent call last):
  File "./broadlink_discovery", line 16, in <module>
    if device.auth():
  File "/usr/local/lib/python3.7/dist-packages/broadlink/device.py", line 198, in auth
    check_error(response[0x22:0x24])
  File "/usr/local/lib/python3.7/dist-packages/broadlink/exceptions.py", line 137, in check_error
    raise exception(error_code)
broadlink.exceptions.AuthenticationError: [Errno -1] Authentication failed

Sorry for stupid question - should these manipulations be carried out in AP mode, or with AC Freedom connected? And manipulations with ./monitor.py ? Maybe AC Freedom is interfering with authentication?

The aircon need to be connected to the network , so AC freedom should been used already to get it configured.

Only thing I can think of is that it needs a actual "password" on the auth. currentley it just uses test01 . Only way to tell is with network sniff. I see there is a Android wireshark util to sniff traffic.

LordDethman commented 3 years ago

Sorry I have been super busy last half of the week. Just catching up on this thread. I will try and see what I can do for you this evening when I get home. I will see if I can utilize any of the packet capture apps on my android phone. Looks like most require root and I have not rooted my phone so will see if any of the non-root versions will work.

If I have time during the day today I will see if I can capture some of the packets going to the ac units from my home server.

fmobile999 commented 3 years ago

This is pcap from/to AC. I do not have the qualifications to decrypt. :) ballu_bsui18.zip

fmobile999 commented 3 years ago

The aircon need to be connected to the network , so AC freedom should been used already to get it configured.

As described at https://github.com/mjg59/python-broadlink I can switch AC to access point mode and connect to AC directly. May it help to get password from AC?

liaan commented 3 years ago

This is pcap from/to AC. I do not have the qualifications to decrypt. :) ballu_bsui18.zip

Thanks I will make time to decrypt it .. Well, Actually all I do is stick the packets into the script and let script do it ;-)

liaan commented 3 years ago

This is pcap from/to AC. I do not have the qualifications to decrypt. :) ballu_bsui18.zip

Hi,

Is this the traffic from the AC freedom device to AC .. or the AC to the cloud?

fmobile999 commented 3 years ago

Yes, it's traffic AC <> Cloud, shiffed on router/gateway by wireshark & openwrt wireshark helper.

liaan commented 3 years ago

Yes, it's traffic AC <> Cloud, shiffed on router/gateway by wireshark & openwrt wireshark helper.

aa ok, make more sense now .....

Can you possibly capture the traffic between the AC freedom app and the AC, that should include the auth part.. You might be able to setup a port mirror for wifi connections on the router and do it that way...

fmobile999 commented 3 years ago

Ok, tomorrow i'll do it.

fmobile999 commented 3 years ago

traffic Android <> Cloud Phone_to_cloud.zip

liaan commented 3 years ago

traffic Android <> Cloud Phone_to_cloud.zip

Thanks But I need the traffic from your Android (Ac freedom app) to the AC itself (local lan). Simplest is to switch internet off , start capturing the AC wifi port and then open AC freedom on your Android.

fmobile999 commented 3 years ago

AC Freedom don't work without internet. No communication with aircon, no add new device locally. no_internet.zip

liaan commented 3 years ago

AC Freedom don't work without internet. No communication with aircon, no add new device locally. no_internet.zip

mmmmm that is interesting. Works fine here (my setup) as its talks direct to the AC over the wifi. it does not use the cloud.

Let me go through all the captures and see if there might be a way to get this to work.