bilan/connectlife-api-connector

Typed property App\Services\MqttService::$acDevices must not be accessed before initialization

bartashevich opened this issue · 4 comments

Failing to start mqtt service, both on hass and on an external docker container

[2024-03-15 19:32:44] production.ERROR: Typed property App\Services\MqttService::$acDevices must not be accessed before initialization {"exception":"[object] (Error(code: 0): Typed property App\\Services\\MqttService::$acDevices must not be accessed before initialization at /home/app/app/Services/MqttService.php:25)
[stacktrace]
#0 /home/app/app/Console/Commands/MqttLoop.php(25): App\\Services\\MqttService->setupHaDiscovery()
#1 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\MqttLoop->handle()
#2 /home/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#3 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#4 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#5 /home/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#6 /home/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#7 /home/app/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#8 /home/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#9 /home/app/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#10 /home/app/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#11 /home/app/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#12 /home/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#13 /home/app/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#14 {main}
"} 

In MqttService.php line 25:
                                                                                                  
  Typed property App\Services\MqttService::$acDevices must not be accessed before initialization

Hi,
could you please paste logs soon after the add-on starts?

I have a similar issue, but I think it's because we have different model
Reviewing the logs, I have a deviceTypeCode: 006 and the function getOnlineAcDevices() skips over any devices that don't have a 009 code :(

For context, this is the Hisense AP55023HR1GD

https://github.com/Bilan/connectlife-api-connector/blob/main/app/Services/ConnectlifeApiService.php

[2024-03-20 05:49:23] production.INFO: Skipping device with unknown type code: pu000068650051000200030003000000c6e1c507968 {"wifiId":"8650051000200030003000000c6e1c507968","deviceId":"8650051000200030003000000c6e1c507968","puid":"pu000068650051000200030003000000c6e1c507968","deviceNickName":"Portable air conditioner","deviceFeatureCode":"201","deviceFeatureName":"201冷暖机型无功率","deviceTypeCode":"006","deviceTypeName":"","bindTime":1707001929203,"role":1,"roomId":3663286,"roomName":"default_room","statusList":{"t_sleep":"0","t_power":"1","t_work_mode":"2","t_fan_speed":"0","t_fan_speed_s":"0","t_fan_mute":"0","t_super":"0","t_eco":"0","t_temp":"66","t_temp_type":"1","t_up_down":"0","t_swing_follow":"0","t_swing_direction":"0","t_swing_angle":"0","t_fanspeedcv":"0","t_tms":"0","t_temp_compensate":"13","f_humidity":"128","f_temp_in":"68","f_electricity":"0","f_votage":"0","f_e_intemp":"0","f_e_incoiltemp":"0","f_e_inhumidity":"0","f_e_infanmotor":"0","f_e_arkgrille":"0","f_e_invzero":"0","f_e_incom":"0","f_e_indisplay":"0","f_e_inkeys":"0","f_e_inwifi":"0","f_e_inele":"0","f_e_ineeprom":"0","f_e_outeeprom":"0","f_e_outcoiltemp":"0","f_e_outgastemp":"0","f_e_outtemp":"0","f_e_waterfull":"0","f_e_upmachine":"0","f_e_dwmachine":"0","f_e_over_cold":"0","f_e_over_hot":"0","f_e_push":"0","t_demand_response":"0","t_dal":"0","t_talr":"0","f-filter":"0","f_ecm":"0","daily_energy_kwh":0},"useTime":1707001929182,"offlineState":1,"seq":0,"createTime":0} 

2024-03-19 22:49:23,125 DEBG 'mqtt' stdout output:
[2024-03-20 05:49:23] production.ERROR: Typed property App\Services\MqttService::$acDevices must not be accessed before initialization {"exception":"[object] (Error(code: 0): Typed property App\\Services\\MqttService::$acDevices must not be accessed before initialization at /home/app/app/Services/MqttService.php:25)
[stacktrace]
#0 /home/app/app/Console/Commands/MqttLoop.php(25): App\\Services\\MqttService->setupHaDiscovery()
#1 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\MqttLoop->handle()
#2 /home/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#3 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#4 /home/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#5 /home/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#6 /home/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#7 /home/app/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#8 /home/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#9 /home/app/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#10 /home/app/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#11 /home/app/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#12 /home/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#13 /home/app/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#14 {main}
"} 

@poopoopootrain0 thank your for the details. Your problem should be fixed in v2.1.4 released today.

Thank you.