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

Average over time period fails #24

Closed
mattsmallman opened this issue Jan 17, 2021 · 2 comments
Closed

Average over time period fails #24

mattsmallman opened this issue Jan 17, 2021 · 2 comments
Labels
bug Something isn't working.

Comments

@mattsmallman
Copy link

Versions

  • Version of the Home Assistant: 2021.1.2
  • Version of the custom component: 1.6.6

Configuration

- platform: average
  name: Bedroom Average Overnight Temperature
  start: '{{ as_timestamp( now().replace(hour=23).replace(minute=0).replace(second=0) ) - 86400 }}'
  duration:
    hours: 8
  entities:
    - sensor.bedroom_sensor_temperature

Describe the bug

I have several average sensors to assess environmental factors that might impact sleep quality so average from 11 pm to 7am. These all worked for many months but after a HASS release (aprox 17 Dec - but don't know exactly which version as I am usually take a few days to update) they all fail with this error. I have tried various different timestamp and date time configurations but without success.

To Reproduce

n/a

Expected behavior

Average temperature from 11pm last night to 7am this morning.

Screenshots

n/a

Debug log


Logger: homeassistant.helpers.entity
Source: util/dt.py:131 
First occurred: 22:01:22 (4 occurrences) 
Last logged: 22:02:47

Update for sensor.bedroom_average_overnight_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/average/sensor.py", line 280, in update
    self._update_state()
  File "/config/custom_components/average/sensor.py", line 369, in _update_state
    self._update_period()
  File "/config/custom_components/average/sensor.py", line 305, in _update_period
    start = dt_util.parse_datetime(start_rendered)
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 131, in parse_datetime
    return ciso8601.parse_datetime(dt_str)
TypeError: argument 1 must be str, not float

Additional context

First ever GitHub Issue so please be gentle and let me know if you need more context.

@mattsmallman mattsmallman added the bug Something isn't working. label Jan 17, 2021
Limych added a commit that referenced this issue Jan 22, 2021
@Limych
Copy link
Owner

Limych commented Jan 22, 2021

Thank you for bugreport

@Limych Limych closed this as completed Jan 22, 2021
Limych pushed a commit that referenced this issue Mar 2, 2021
@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants