wogri / hass-blinds

Homessistant Blind library
Apache License 2.0
17 stars 1 forks source link

unknown inside temperature. doing nothing. #1

Closed kaczkalolo closed 3 years ago

kaczkalolo commented 3 years ago

I've set up all the blinds and in the input_text helper i get: unknown inside temperature. doing nothing. As an inside for each blind i've put: inside_temperature: sensor.inside_temperature in apps.yaml That's my inside termometer. I dont have thermostats at all- well i do have one but it is only for heating which is off in summer time. What am i doing not right?

wogri commented 3 years ago

Hi and thanks for using this :)

What happens if you go to your home assistant and put that sensor into the developer tools / states section? In my case it looks like this:

Screenshot 2021-07-27 at 11 39 55

kaczkalolo commented 3 years ago

image

27C inside- it's very hot today :0

wogri commented 3 years ago

It's too hot, you clearly need some blind automation :)

It's clear that the sensor works. The problem is though that it doesn't have a current_temperature attribute. In that case, just add inside_temperature_is_no_thermostat: true to your config like in the screenshot below.

Screenshot 2021-07-27 at 11 46 37

kaczkalolo commented 3 years ago

Ok now i got: Blinds are controlled manually- so how do i release them from being controlled manually? tried to restart appdeamon but that did not help. Tried with touch blinds.py but nothing happens

wogri commented 3 years ago

Blinds are controlled manually is a state where the engine feels: "that's what you configured, I'm doing what you requested". Now I need to see your apps.yml.

kaczkalolo commented 3 years ago

apps $ cat apps.yaml

global_modules:
- blinds_lib
  - hysteresis_lib
- sun_lib
- hysteresis_lib

sun:
  class: Sun
  module: sun
  global_dependencies:
  - sun_lib
  brightness_sensor: sensor.illumination_158d00068a014f
  brightness_at_dawn_sensor: sensor.illumination_158d00068a014f

max_temp:
  class: MaxTemp
  module: max_temp
  outside_temp_sensor: sensor.outside_temperature
  max_temp_sensor: input_number.max_outside_temp_over_24_hours
  max_temp_sensor_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours

blind_livingroom1:
  class: Blinds
  module: blinds
  global_dependencies:
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.living_room_blind_1
  inside_temperature: sensor.inside_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.wind_alarm
  outside_temperature_sensor: sensor.outside_temperature
  blind_config:
    azimuth_entry: 105
    azimuth_exit: 250
    manual_day_control: True
    manual_night_control: True
    max_inside_temperature_cold_day: 24
    kill_switch_hold_time: 1

blind_livingroom2:
  class: Blinds
  module: blinds
  global_dependencies:
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.living_room_blind_2
  inside_temperature: sensor.inside_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.wind_alarm
  outside_temperature_sensor: sensor.outside_temperature
  blind_config:
    azimuth_entry: 105
    azimuth_exit: 250
    manual_day_control: True
    manual_night_control: True
    max_inside_temperature_cold_day: 24
    kill_switch_hold_time: 1

blind_diningroom3:
  class: Blinds
  module: blinds
  global_dependencies:
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.dining_room_blind_3
  inside_temperature: sensor.inside_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.wind_alarm
  outside_temperature_sensor: sensor.outside_temperature
  blind_config:
    azimuth_entry: 180
    azimuth_exit: 290
    manual_day_control: True
    manual_night_control: True
    max_inside_temperature_cold_day: 24
    kill_switch_hold_time: 1

blind_diningroom4:
  class: Blinds
  module: blinds
  global_dependencies:
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.dining_room_blind_4
  inside_temperature: sensor.inside_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.wind_alarm
  outside_temperature_sensor: sensor.outside_temperature
  blind_config:
    azimuth_entry: 180
    azimuth_exit: 290
    manual_day_control: True
    manual_night_control: True
    max_inside_temperature_cold_day: 24
    kill_switch_hold_time: 1

blind_kitchen:
  class: Blinds
  module: blinds
  global_dependencies:
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.kitchen_blind_1
  inside_temperature: sensor.inside_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.wind_alarm
  outside_temperature_sensor: sensor.outside_temperature
  blind_config:
    azimuth_entry: 180
    azimuth_exit: 290
    manual_day_control: True
    manual_night_control: True
    max_inside_temperature_cold_day: 24
    kill_switch_hold_time: 1
wogri commented 3 years ago

Yeah, manual_day_control: True and manual_night_control: True mean: don't pull the blinds down or up automatically. Remove those lines and see what it does (also: I don't know what you would expect, I'd be curious to know).

kaczkalolo commented 3 years ago

Ok now it has started to do something:

What i want is to automate it at day time and i will close them at night and they should open in the morning automatically. What i would also want is to close them automatically but not totally but to 15% then i still get some light through the holes.

Oh one more thing- i don't have a lux sensor outside so i used one that i have inside- now it is sunny and this is what i have: image

wogri commented 3 years ago

Kill switch is turned on if the expected state (for example blinds position = 100) does not match reality. That means the system thinks that a human overrode what the computer decided, and it will not do anything for the default of 4 hours. That could also be because it set an angle for your blinds but your system doesn't support this. Look at the logs of appdaemon, it will spit out useful information about the kill switch (why it turned it on).

What i would also want is to close them automatically but not totally but to 15% then i still get some light through the holes

I do this with the angle that I can set with my blinds. If your blinds don't support an angle you will have to do some trickery in the code to leave them 15% open (e. g. modify the DOWN variable in lib/blinds.py). The code actually adjusts the angle depending on the height of the sun so you always get maximum light in.

The lux sensor sensor inside will give you very different values than an outside one (e. g. I put the blinds down at 60,000 lux outside for example, you will never reach this inside), you would have to adjust sun.py probably, otherwise it would not detect direct sunlight or situations where it would make sense that the blinds are down during the day.

kaczkalolo commented 3 years ago

2021-07-27 12:35:06.089131 INFO blind_diningroom4: Turning Kill switch on: last_postion: 100, knx_current_position: 100, last_angle: 100, knx_current_angle: None 2021-07-27 12:35:06.100784 INFO blind_kitchen: Turning Kill switch on: last_postion: 100, knx_current_position: 100, last_angle: 100, knx_current_angle: None 2021-07-27 12:35:06.104525 INFO blind_diningroom3: Turning Kill switch on: last_postion: 100, knx_current_position: 100, last_angle: 100, knx_current_angle: None 2021-07-27 12:35:06.112659 INFO blind_livingroom1: Turning Kill switch on: last_postion: 100, knx_current_position: 100, last_angle: 100, knx_current_angle: None 2021-07-27 12:35:06.119744 INFO blind_livingroom2: Turning Kill switch on: last_postion: 100, knx_current_position: 100, last_angle: 100, knx_current_angle: None

Yeah i have simple blinds without tilt. How can i disable that? I need to think about some light sensor then- anything cheap You would recommend?

wogri commented 3 years ago

okay, that explains the kill switch. there is no option to disable angle checking. But I will write something for you, it's not hard. It might take me a day or three, ping me by the end of the week if I didn't come back to you.

As for light sensor: I can't give you a good advice, my light sensor also includes a rain and wind sensor and is more than 800 Euros, so I won't recommend that one :)

kaczkalolo commented 3 years ago

Cool. Thanks a lot. I really appreciate your work. Great stuff 👍

joelinux60 commented 3 years ago

Oh one more thing- i don't have a lux sensor outside so i used one that i have inside- now it is sunny and this is what i have: image

Hello, happened to be in similar situation. Could resolve the unknown inside temperature issue thanks to information found here. Now I'm seeing Kill switch being turned on due to my covers are 'simple' ones not allowing for a angle/Tilt setting. Going to keep an eye here to give an enhanced version a try.

Regarding lux sensor. A Xiaomi MiJia GZCGQ01LM is working here. It's installed inside, behind window and delivers sensor data up to 80'000 lux for a clear and sunny day. Need to take care to not close blind too much of that window where my GZCGQ01LM is looking through.

image

Please see chart below for yesterday's lux measurements

image

Kind regards

kaczkalolo commented 3 years ago

I've ordered that sensor yesterday- will get it today. I'm wondering what would be the best place to mount it??? Does it need to be direct sunlight or can it be mounted under roofs ledge? And which side of house would be the best?

wogri commented 3 years ago

https://github.com/wogri/hass-blinds/commit/d9ecae4986634080b7bf58da9bb5adcde8ea65b4 (which I also merged into master) should do the needful. After applying this patch setting disable_tilt: true in your yaml blind config should solve the problem with the kill switch. I only tested it in a unit test, so let me know if it works for real.

wogri commented 3 years ago

I'm wondering what would be the best place to mount it??? Does it need to be direct sunlight or can it be mounted under roofs ledge? And which side of house would be the best?

Top of your house so it can get direct sunlight. if it's under the roofs ledge it will not give you accurate numbers.

joelinux60 commented 3 years ago

Hi,

did download from master and installed all of it to appdaemon. Adding disable_tilt: true yields into:

2021-07-28 14:46:18.755207 WARNING blind_HWR: ------------------------------------------------------------
2021-07-28 14:46:18.754865 WARNING blind_HWR: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/appdaemon/app_management.py", line 161, in initialize_app
    await utils.run_in_executor(self, init)
  File "/usr/local/lib/python3.8/site-packages/appdaemon/utils.py", line 299, in run_in_executor
    response = future.result()
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/conf/apps/blinds.py", line 15, in initialize
    self.tick(None)
  File "/conf/apps/blinds.py", line 179, in tick
    self.evaluate()
  File "/conf/apps/blinds.py", line 76, in evaluate
    we_have_work = self.b.Evaluate()
  File "/conf/apps/lib/blinds_lib.py", line 280, in Evaluate
    angle_diff = abs(self.last_angle - self.knx_current_angle)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

2021-07-28 14:46:18.754003 WARNING blind_HWR: ------------------------------------------------------------
2021-07-28 14:46:18.753653 WARNING blind_HWR: Worker Ags: {}
2021-07-28 14:46:18.753284 WARNING blind_HWR: Unexpected error in worker for App blind_HWR:
2021-07-28 14:46:18.752773 WARNING blind_HWR: ------------------------------------------------------------

My apps.yml looks like this:

hello_world:
  module: hello
  class: HelloWorld

global_modules:
 - blinds_lib
 - hysteresis_lib
 - sun_lib
 - hysteresis_lib

sun:
  class: Sun
  module: sun
  global_dependencies: 
  - sun_lib
  brightness_sensor: sensor.gzcgq01lm_xiaomi_mijia_light_intensity_sensor_illuminance_lux
  brightness_at_dawn_sensor: sensor.gzcgq01lm_xiaomi_mijia_light_intensity_sensor_illuminance_lux

max_temp:
  class: MaxTemp
  module: max_temp
  outside_temp_sensor: sensor.ble_temperature_eingang_sensor
  max_temp_sensor: input_number.max_outside_temp_over_24_hours
  max_temp_sensor_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours

blind_HWR:
  class: Blinds
  module: blinds
  global_dependencies: 
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  blind: cover.rolllade_hwr
  contact: binary_sensor.hwr_xiaomi_door_window_contact_contact
  inside_temperature: sensor.xiaomi_temphumhpa_hwr_temperature
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  wind_alarm: binary_sensor.devolo_arbeit_tamper
  outside_temperature_sensor: sensor.ble_temperature_eingang_sensor
  blind_config:
    azimuth_entry: 180
    azimuth_exit: 260
    window_type: door
    kill_switch_hold_time: 1
    disable_tilt: true
wogri commented 3 years ago

ah yes, please try the latest master, I just fixed this. I won't have time to write a unit test to catch this today, though...

joelinux60 commented 3 years ago

Much better now. Thank you!

It's cloudy weather today, so will see if shading takes action.

2021-07-28 15:35:19.047997 INFO blind_HWR: Minimum temperature to get down blinds is: 21.0C (seems like warm season)
2021-07-28 15:35:19.033475 INFO blind_HWR: Not setting the tilt as these blinds don't have that feature.
2021-07-28 15:35:18.962643 INFO blind_HWR: Changing position of blind cover.rolllade_hwr from 90 to 100 because: Blinds go up, there is not enough sun
2021-07-28 15:35:18.943821 INFO blind_HWR: Initializing blinds...
2021-07-28 15:35:18.928867 INFO AppDaemon: Initializing app blind_HWR using class Blinds from module blinds
2021-07-28 15:35:18.926271 INFO AppDaemon: Terminating blind_HWR
2021-07-28 15:35:18.907479 INFO AppDaemon: Found 4 total apps
2021-07-28 15:35:18.903397 INFO AppDaemon: App 'blind_HWR' changed
2021-07-28 15:35:18.894895 INFO AppDaemon: /conf/apps/apps.yaml added or modified
2021-07-28 15:35:18.867459 INFO AppDaemon: Reading config
2021-07-28 15:34:28.917910 INFO blind_HWR: Minimum temperature to get down blinds is: 21.0C (seems like warm season)
2021-07-28 15:34:28.893422 INFO blind_HWR: Initializing blinds...
2021-07-28 15:34:28.886521 INFO AppDaemon: Initializing app blind_HWR using class Blinds from module blinds
2021-07-28 15:34:28.871964 INFO AppDaemon: Reloading Module: /conf/apps/lib/blinds_lib.py
2021-07-28 15:34:28.864973 INFO AppDaemon: Terminating blind_HWR
kaczkalolo commented 3 years ago

Ok I got the luminance Sensor and it works great now.!!! Love it. Thanks so much for your work. I got one more question- LUX DARK and LUX DARK WITH LIGHT INSIDE- First one when Light is below blinds will close right? The second one- what is it for? And how do you measure it? Some other Sensor inside?

wogri commented 3 years ago

Good question. LUX DARK is correct - if the lux value is below this value then the blinds will close. The second one is only relevant if you have defined dawn_lights like here:

blind_esszimmer_west_hebe_schiebetuer:
  class: Blinds
  module: blinds
  global_dependencies: 
  - blinds_lib
  - hysteresis_lib
  - sun_lib
  inside_temperature: sensor.erdgeschoss_esszimmer_temperatur
  inside_temperature_is_no_thermostat: true
  max_temp_sensor_value_yesterday: input_number.yesterdays_max_outside_temp_over_24_hours
  blind: cover.raffstore_erdgeschoss_kueche_schiebetuer_west
  wind_alarm: binary_sensor.wetter_zentrale_funktionen_windalarm_jalousien
  outside_temperature_sensor: sensor.wetter_zentrale_funktionen_aussentemperatur
  contact: binary_sensor.kontakt_erdgeschoss_kueche_hebe_schiebetuer
  blind_config:
    azimuth_entry: 173
    azimuth_exit: 276
    ledge: 200
    window_azimuth_position: 263
    window_type: door
    kill_switch_hold_time: 4
    # manual_night_control: True
  dawn_lights:
  - light.dimmer_erdgeschoss_essbereich
  - light.dimmer_erdgeschoss_kuechenzeile
  - light.licht_erdgeschoss_esstisch

Once you set dawn_lights and one of those lights is turned on then the threshold to put the blinds down will be raised to LUX_DARK_WITH_LIGHT_INSIDE. The reason for this is that my wife complained why the blinds haven't gone down yet when she turned on the light because she felt "in the spotlight". I realized that one needs a different threshold (higher lux value) for when the lights are turned on for certain rooms (like our dining room) because the subjective feeling for how dark it is outside changes once the lights are on.

kaczkalolo commented 3 years ago

Got it - good to know. Today i woke up and blinds were still closed. Input_text says: Masterlock is on for blind - for every blind- any help with this? Also i got couple blinds were sun never reaches them but still would like to automate them to close at night and open in the morning- what would be the best way to do that with haas-blinds (i know that i coould do that with simple automation based on outside luminance but yours is better)?

kaczkalolo commented 3 years ago

Got it - good to know. Today i woke up and blinds were still closed. Input_text says: Masterlock is on for blind - for every blind- any help with this? Also i got couple blinds were sun never reaches them but still would like to automate them to close at night and open in the morning- what would be the best way to do that with haas-blinds (i know that i coould do that with simple automation based on outside luminance but yours is better)?

Also got some errors in appdaemon log: 2021-08-01 21:50:44.127989 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.129257 WARNING blind_livingroom2: Unexpected error in worker for App blind_livingroom2: 2021-08-01 21:50:44.130486 WARNING blind_livingroom2: Worker Ags: {'id': 'ca2198478f104aceb2c4cc6b438f220c', 'name': 'blind_livingroom2', 'objectid': '1c8f6e74c29f4ccb884e0a601a23444e', 'type': 'scheduler', 'function': <bound method Blinds.tick of <blinds.Blinds object at 0x7f8c9d6b50>>, 'pin_app': True, 'pin_thread': 3, 'kwargs': {'interval': 60, 'thread_id': 'thread-3'}} 2021-08-01 21:50:44.131695 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.133774 WARNING blind_livingroom2: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 890, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/hass-blinds/blinds.py", line 179, in tick self.evaluate() File "/config/appdaemon/apps/hass-blinds/blinds.py", line 86, in evaluate self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=position) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 197, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 308, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) File "/usr/lib/python3.8/concurrent/futures/_base.py", line 446, in result raise TimeoutError() concurrent.futures._base.TimeoutError 2021-08-01 21:50:44.134763 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.140770 WARNING AppDaemon: callback tick() in blind_livingroom2 has now completed 2021-08-01 21:51:34.138317 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-01 21:51:35.123151 INFO blind_kitchen: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-01 21:51:43.526250 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-01 21:51:43.805794 INFO blind_kitchen: Not setting the tilt as these blinds don't have that feature. 2021-08-01 21:52:34.172169 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-01 21:52:35.117465 INFO blind_kitchen: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-01 21:52:44.177339 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.178938 WARNING blind_diningroom3: Unexpected error in worker for App blind_diningroom3: 2021-08-01 21:52:44.179856 WARNING blind_diningroom3: Worker Ags: {'id': '01041bbcaad14a7b934a574af29266aa', 'name': 'blind_diningroom3', 'objectid': 'c570fd00e5f34a1598aaae00f5851019', 'type': 'scheduler', 'function': <bound method Blinds.tick of <blinds.Blinds object at 0x7f8c9d6c10>>, 'pin_app': True, 'pin_thread': 4, 'kwargs': {'interval': 60, 'thread_id': 'thread-4'}} 2021-08-01 21:52:44.182201 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.187864 WARNING blind_diningroom3: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 890, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/hass-blinds/blinds.py", line 179, in tick self.evaluate() File "/config/appdaemon/apps/hass-blinds/blinds.py", line 86, in evaluate self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=position) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 197, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 308, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) File "/usr/lib/python3.8/concurrent/futures/_base.py", line 446, in result raise TimeoutError() concurrent.futures._base.TimeoutError 2021-08-01 21:52:44.188724 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.192721 WARNING AppDaemon: callback tick() in blind_diningroom3 has now completed

wogri commented 3 years ago

If blinds should go up in the morning and down in the evening just remove the following parameters from the config file:

manual_day_control: True
manual_night_control: True

The error you are getting is new to me and points to some internal problems of your appdaemon (seems to run into a timeout). Maybe you need to increase the number of threads in your appdaemon.yaml?

I have:

appdaemon:
  threads: 40
wogri commented 3 years ago

Input_text says: Masterlock is on for blind

This is because of the errors you see in the logfiles that you attached. I assume that if you increase the number of threads this should be good.

kaczkalolo commented 3 years ago

If blinds should go up in the morning and down in the evening just remove the following parameters from the config file:

manual_day_control: True
manual_night_control: True

Ok that would automate blind for night and day but i wouldn't like to automate it during the day- it should stay open all day...

wogri commented 3 years ago

Ah, in that case just set the azimuth values to something irrational:

    azimuth_entry: 361
    azimuth_exit: 362

Azimuth will never be bigger than 359.

kaczkalolo commented 3 years ago

Thanks. Any possibility to add some delay between closing/opening blinds in the morning or evening? I have Somfy controlled blinds and the problem is that i can't control more then 10 blinds at once. That's a Somfy limit and i can't change it. So it would be really nice if there was a way to add some delay or somehow control how many blinds can be operated at once...

wogri commented 3 years ago

Oh, interesting. Can you open a separate issue as a feature request? It should be trivial to add this. Can you then be more precise what this means - can not more than 10 blinds run at the same time, or can't you send the command to move blinds to more than 10 blinds at once?

kaczkalolo commented 3 years ago

Got it - good to know. Today i woke up and blinds were still closed. Input_text says: Masterlock is on for blind - for every blind- any help with this? Also i got couple blinds were sun never reaches them but still would like to automate them to close at night and open in the morning- what would be the best way to do that with haas-blinds (i know that i coould do that with simple automation based on outside luminance but yours is better)?

Also got some errors in appdaemon log: 2021-08-01 21:50:44.127989 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.129257 WARNING blind_livingroom2: Unexpected error in worker for App blind_livingroom2: 2021-08-01 21:50:44.130486 WARNING blind_livingroom2: Worker Ags: {'id': 'ca2198478f104aceb2c4cc6b438f220c', 'name': 'blind_livingroom2', 'objectid': '1c8f6e74c29f4ccb884e0a601a23444e', 'type': 'scheduler', 'function': <bound method Blinds.tick of <blinds.Blinds object at 0x7f8c9d6b50>>, 'pin_app': True, 'pin_thread': 3, 'kwargs': {'interval': 60, 'thread_id': 'thread-3'}} 2021-08-01 21:50:44.131695 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.133774 WARNING blind_livingroom2: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 890, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/hass-blinds/blinds.py", line 179, in tick self.evaluate() File "/config/appdaemon/apps/hass-blinds/blinds.py", line 86, in evaluate self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=position) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 197, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 308, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) File "/usr/lib/python3.8/concurrent/futures/_base.py", line 446, in result raise TimeoutError() concurrent.futures._base.TimeoutError 2021-08-01 21:50:44.134763 WARNING blind_livingroom2: ------------------------------------------------------------ 2021-08-01 21:50:44.140770 WARNING AppDaemon: callback tick() in blind_livingroom2 has now completed 2021-08-01 21:51:34.138317 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-01 21:51:35.123151 INFO blind_kitchen: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-01 21:51:43.526250 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-01 21:51:43.805794 INFO blind_kitchen: Not setting the tilt as these blinds don't have that feature. 2021-08-01 21:52:34.172169 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-01 21:52:35.117465 INFO blind_kitchen: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-01 21:52:44.177339 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.178938 WARNING blind_diningroom3: Unexpected error in worker for App blind_diningroom3: 2021-08-01 21:52:44.179856 WARNING blind_diningroom3: Worker Ags: {'id': '01041bbcaad14a7b934a574af29266aa', 'name': 'blind_diningroom3', 'objectid': 'c570fd00e5f34a1598aaae00f5851019', 'type': 'scheduler', 'function': <bound method Blinds.tick of <blinds.Blinds object at 0x7f8c9d6c10>>, 'pin_app': True, 'pin_thread': 4, 'kwargs': {'interval': 60, 'thread_id': 'thread-4'}} 2021-08-01 21:52:44.182201 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.187864 WARNING blind_diningroom3: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 890, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/hass-blinds/blinds.py", line 179, in tick self.evaluate() File "/config/appdaemon/apps/hass-blinds/blinds.py", line 86, in evaluate self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=position) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 197, in inner_sync_wrapper f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs)) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 308, in run_coroutine_threadsafe result = future.result(self.AD.internal_function_timeout) File "/usr/lib/python3.8/concurrent/futures/_base.py", line 446, in result raise TimeoutError() concurrent.futures._base.TimeoutError 2021-08-01 21:52:44.188724 WARNING blind_diningroom3: ------------------------------------------------------------ 2021-08-01 21:52:44.192721 WARNING AppDaemon: callback tick() in blind_diningroom3 has now completed

I did a very simple test. Created apps that close/open blinds and tested it and i did not get the above error... Wonder what could it be.

`cat testblinds.py import appdaemon.plugins.hass.hassapi as hass

class testblinds(hass.Hass):

def initialize(self): self.listen_state(self.closeblinds, "input_boolean.testblinds", new="on") self.listen_state(self.openblinds, "input_boolean.testblinds", new="off")

def closeblinds(self, entity, attribute, old, new, kwargs): self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=15)

def openblinds(self, entity, attribute, old, new, kwargs): self.call_service("cover/set_cover_position", entity_id=self.args["blind"], position=100) `

kaczkalolo commented 3 years ago

I even tried with more then 10 blinds and yes i got error saying that it is more then gateway can do but still did not get that error in appdaemon... Is there any way to remove that "Masterlock is on for blind" lock?

wogri commented 3 years ago

Is there any way to remove that "Masterlock is on for blind" lock?

Can you show me the content of your appdaemon.yaml stripping out your location obviously? I think it's an issue with the number of concurrent threads as I mentioned here.

kaczkalolo commented 3 years ago

cat config/appdaemon/appdaemon.yaml

secrets: /config/secrets.yaml appdaemon: latitude: xxx longitude: xxx elevation: xx time_zone: Europe/Warsaw plugins: HASS: type: hass http: url: http://127.0.0.1:5050 admin: api: hadashboard:

I have no threads variable set- they even say that You shouldn't do that in newest version i think. Anyway today i had no error so it is very random and can't really say what could be the problem

wogri commented 3 years ago

As I assumed above, you're running on the default thread number.

From https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html:

Normally, AppDaemon will create enough threads to provide one per app, or default to 10 if app pinning is turned off. Setting this to a value will turn off automatic thread management.

I would recommend setting the number of threads to something like 20 or 40 like I pointed out above:

$ cat appdaemon.yaml                                                                                                                                    08/03/21 7:13:55
appdaemon:
  threads: 40
  # Location required to calculate the time the sun rises and sets
  latitude: YY
  longitude: XX
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 303                            
  time_zone: Europe/Vienna
  plugins:
    HASS:
      type: hass
      ha_url: ...
      token: ...
wogri commented 3 years ago

I have no threads variable set- they even say that You shouldn't do that in newest version i think. Anyway today i had no error so it is very random and can't really say what could be the problem

Try it out, it won't hurt and if it happens to be random it sounds exactly like a threading issue.

kaczkalolo commented 3 years ago

Ok one more thing. These are my sun variables: LUX_DARK = 5 # Lux when we consider things to be dark. LUX_DARK_WITH_LIGHT_INSIDE = 140 # Lux when we think it's dark outside because we turned the light on. LUX_BLIND_DOWN_THRESHOLD = 40000 # Lux when blinds should go down. LUX_BLIND_UP_THRESHOLD = 20000 # Lux when hysteresis decides to go up again. LUX_BLIND_UP_THRESHOLD_EVENING = 20000 # Lux when the evening has started and there is no point in having the blinds down anymore. LUX_DAYLIGHT = 200 # Lux when I think the day has started. MINUTES_AVERAGE = 7 # The time it takes to calculate the average of the current sun.

So blinds close at 5 in the evening and that's easy and works. But i don't understand when they open up. I thought that when LUX_DAYLIGHT is reached blinds will open but today they opened up at 5:08 when there was: Sun Lux 10 minute average changed to 128.611111111111 Lux by Supervisor 5:08:36 AM - 2 hours ago

How does that work? And what is it doing at 4:40 and every minute before that? I got huge log saying thye're moving from 10 to 15???

2021-08-03 04:37:08.216523 INFO blind_livingroom1: Changing position of blind cover.living_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.345436 INFO blind_diningroom1: Changing position of blind cover.dining_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.352587 INFO blind_kitchen_1: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.358795 INFO blind_diningroom2: Changing position of blind cover.dining_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.365850 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.370925 INFO blind_livingroom2: Changing position of blind cover.living_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.390672 INFO blind_boiler_room: Changing position of blind cover.boiler_room_blind from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.407314 INFO blind_diningroom4: Changing position of blind cover.dining_room_blind_4 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.409748 INFO blind_kitchen_2: Changing position of blind cover.kitchen_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:37:08.773113 INFO blind_livingroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:08.967984 INFO blind_diningroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:08.991969 INFO blind_diningroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.021178 INFO blind_boiler_room: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.034151 INFO blind_livingroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.037394 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.063146 INFO blind_kitchen_2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.085229 INFO blind_kitchen_1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:37:09.099387 INFO blind_diningroom4: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:08.289367 INFO blind_diningroom2: Changing position of blind cover.dining_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.417408 INFO blind_diningroom1: Changing position of blind cover.dining_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.425043 INFO blind_diningroom4: Changing position of blind cover.dining_room_blind_4 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.453173 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.464662 INFO blind_boiler_room: Changing position of blind cover.boiler_room_blind from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.467860 INFO blind_livingroom2: Changing position of blind cover.living_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.470001 INFO blind_kitchen_1: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.473527 INFO blind_livingroom1: Changing position of blind cover.living_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:08.477882 INFO blind_kitchen_2: Changing position of blind cover.kitchen_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:38:09.411461 INFO blind_diningroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.513944 INFO blind_diningroom4: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.518749 INFO blind_kitchen_2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.523723 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.527346 INFO blind_kitchen_1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.530900 INFO blind_diningroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.545733 INFO blind_boiler_room: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.551247 INFO blind_livingroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:38:09.583292 INFO blind_livingroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:08.201654 INFO blind_boiler_room: Changing position of blind cover.boiler_room_blind from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.279537 INFO blind_livingroom2: Changing position of blind cover.living_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.307481 INFO blind_livingroom1: Changing position of blind cover.living_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.348661 INFO blind_diningroom4: Changing position of blind cover.dining_room_blind_4 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.367556 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.389577 INFO blind_kitchen_1: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.391521 INFO blind_diningroom2: Changing position of blind cover.dining_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.418398 INFO blind_kitchen_2: Changing position of blind cover.kitchen_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.432718 INFO blind_diningroom1: Changing position of blind cover.dining_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:39:08.887227 INFO blind_livingroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:08.903711 INFO blind_boiler_room: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:08.917396 INFO blind_livingroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.010711 INFO blind_diningroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.043639 INFO blind_kitchen_1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.067455 INFO blind_diningroom4: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.083105 INFO blind_kitchen_2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.087046 INFO blind_diningroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:39:09.091361 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:08.246882 INFO blind_livingroom2: Changing position of blind cover.living_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.362626 INFO blind_diningroom4: Changing position of blind cover.dining_room_blind_4 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.385702 INFO blind_livingroom1: Changing position of blind cover.living_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.393428 INFO blind_boiler_room: Changing position of blind cover.boiler_room_blind from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.396819 INFO blind_diningroom1: Changing position of blind cover.dining_room_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.409428 INFO blind_kitchen_2: Changing position of blind cover.kitchen_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.420970 INFO blind_kitchen_1: Changing position of blind cover.kitchen_blind_1 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.422905 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.444957 INFO blind_diningroom2: Changing position of blind cover.dining_room_blind_2 from 10 to 15 because: Down because of darkness 2021-08-03 04:40:08.806382 INFO blind_livingroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:08.901986 INFO blind_diningroom4: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:08.983915 INFO blind_livingroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.035368 INFO blind_boiler_room: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.060730 INFO blind_diningroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.083120 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.102108 INFO blind_diningroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.109129 INFO blind_kitchen_2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 04:40:09.125743 INFO blind_kitchen_1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:08.233691 INFO blind_livingroom2: Changing position of blind cover.living_room_blind_2 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.284007 INFO blind_livingroom1: Changing position of blind cover.living_room_blind_1 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.322507 INFO blind_diningroom3: Changing position of blind cover.dining_room_blind_3 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.340903 INFO blind_diningroom1: Changing position of blind cover.dining_room_blind_1 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.387382 INFO blind_boiler_room: Changing position of blind cover.boiler_room_blind from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.422725 INFO blind_kitchen_2: Changing position of blind cover.kitchen_blind_2 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.442487 INFO blind_kitchen_1: Changing position of blind cover.kitchen_blind_1 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.479917 INFO blind_diningroom4: Changing position of blind cover.dining_room_blind_4 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.489999 INFO blind_diningroom2: Changing position of blind cover.dining_room_blind_2 from 10 to 100 because: Sun has not reached the blind yet 2021-08-03 05:08:08.971930 INFO blind_diningroom3: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.003207 INFO blind_diningroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.024640 INFO blind_livingroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.026765 INFO blind_livingroom1: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.054572 INFO blind_boiler_room: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.057835 INFO blind_diningroom2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.091923 INFO blind_kitchen_2: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.095137 INFO blind_diningroom4: Not setting the tilt as these blinds don't have that feature. 2021-08-03 05:08:09.109904 INFO blind_kitchen_1: Not setting the tilt as these blinds don't have that feature.

wogri commented 3 years ago

But i don't understand when they open up. I thought that when LUX_DAYLIGHT is reached blinds will open but today they opened up at 5:08 when there was: Sun Lux 10 minute average changed to 128.611111111111 Lux by Supervisor

So; the way this works is that it doesn't take the current lux value of the sun. instead it calculates a 10 minute average of the lux value. This helps with sudden spikes so that the blinds don't go up and down all the time if it's a cloudy day.

I am unsure where the output of Sun Lux 10 minute average changed to 128.611111111111 Lux by Supervisor comes from, but this is how this works in the code:

https://github.com/wogri/hass-blinds/blob/7327b717d40969714143947df1a665ef208f67b3/lib/blinds_lib.py#L362

kaczkalolo commented 3 years ago

Seams like it worked today correctly: Dining Room Blind 1 is opening by Supervisor 6:42:48 AM - 23 minutes ago

input_number.sun_lux_10_minute_average: Sun Lux 10 minute average changed to 222.526315789474 Lux by Supervisor 6:42:36 AM - 24 minutes ago