Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: float() argument must be a string or a real number, not 'NoneType' #113

Open
oscfor opened this issue Jan 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@oscfor
Copy link

oscfor commented Jan 1, 2023

Upgraded to latest z2m (1.29.0-1) and suddenly a few of my automations stopped working.

2023-01-01 18:42:34.704447 WARNING vardagsrum: Unexpected error in worker for App vardagsrum:
2023-01-01 18:42:34.704659 WARNING vardagsrum: Worker Ags: {'id': '1b6f22661b3f4ebf9030343d944114a6', 'name': 'vardagsrum', 'objectid': '077134845b1346c0a5596e1040b24db4', 'type': 'state', 'function': <bound method AutoMoLi.motion_detected of <automoli.AutoMoLi object at 0x7fa7702c5c90>>, 'attribute': 'state', 'entity': 'binary_sensor.vardagsrum_rorelse_2_occupancy', 'new_state': 'on', 'old_state': 'off', 'pin_app': True, 'pin_thread': 6, 'kwargs': {'new': 'on', '__thread_id': 'MainThread'}}
2023-01-01 18:42:34.704860 WARNING vardagsrum: ------------------------------------------------------------
2023-01-01 18:42:34.705267 WARNING vardagsrum: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker
    await funcref(
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 567, in motion_detected
    await self.motion_event("state_changed_detection", data, kwargs)
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 596, in motion_event
    await self.lights_on()
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 837, in lights_on
    f"{float(await self.get_state(sensor)) = }",  # type:ignore
TypeError: float() argument must be a string or a real number, not 'NoneType'
2023-01-01 18:42:34.705629 WARNING vardagsrum: ------------------------------------------------------------
2023-01-01 18:43:23.020252 WARNING matsal: ------------------------------------------------------------
2023-01-01 18:43:23.020653 WARNING matsal: Unexpected error in worker for App matsal:
2023-01-01 18:43:23.020884 WARNING matsal: Worker Ags: {'id': '4176dccc553e4975a7d7ad54c71473c7', 'name': 'matsal', 'objectid': '95337447b9554e428fb97a2f5b0ce5f8', 'type': 'state', 'function': <bound method AutoMoLi.motion_detected of <automoli.AutoMoLi object at 0x7fa7702c5d80>>, 'attribute': 'state', 'entity': 'binary_sensor.matsal_aktivitet_occupancy', 'new_state': 'on', 'old_state': 'off', 'pin_app': True, 'pin_thread': 7, 'kwargs': {'new': 'on', '__thread_id': 'MainThread'}}
2023-01-01 18:43:23.021097 WARNING matsal: ------------------------------------------------------------
2023-01-01 18:43:23.021505 WARNING matsal: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker
    await funcref(
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 567, in motion_detected
    await self.motion_event("state_changed_detection", data, kwargs)
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 596, in motion_event
    await self.lights_on()
  File "/config/appdaemon/apps/ad-automoli/automoli.py", line 837, in lights_on
    f"{float(await self.get_state(sensor)) = }",  # type:ignore
TypeError: float() argument must be a string or a real number, not 'NoneType'
2023-01-01 18:43:23.021701 WARNING matsal: ------------------------------------------------------------```
@oscfor
Copy link
Author

oscfor commented Jan 1, 2023

When commenting out illuminance it works again (like below).

  module: automoli
  class: AutoMoLi
  room: matsal

  delay: 3600
  daytimes:
    - { starttime: "06:00", name: morning, light: 30, delay: 1800 }
    - { starttime: "08:00", name: day, light: 30, delay: 3600 }
    - { starttime: "18:15", name: evening, light: 28, delay: 0}
    - { starttime: "20:30", name: night, light: 20, delay: 1800}
    - { starttime: "23:30", name: late_night, light: 5, delay: 900}


  lights:
    - light.matsalsbelysning
    
  # You can specify a list of motion sensors here
  motion:
    - binary_sensor.matsal_aktivitet_occupancy
  illuminance:
  #  - sensor.matsal_aktivitet_illuminance
  illuminance_threshold: 250


  motion_state_on: "on"
  motion_state_off: "off"
  transition_on_daytime_switch: true```

@evildad evildad added the bug Something isn't working label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants