are then only updated at the timed trigger, and keep their value because the input_number hasn’t changed?
I made this python script to not have to do the above for all sensors manually, though it still forces to create all intermediary input_numbers (which I would have liked to prevent with these new trigger based sensors…)
#################################################################################
# Record daystart values for power and usage. To survive restarts, this is done
# with intermediary input_numbers, and an automation calling this Python script
# at midnight
#
# automation:
#
# - alias: Set daystart sensors
# trigger:
# platform: time
# at: '00:00:01'
# action:
# - service: python_script.record_daystart
#################################################################################
switches = 'group.z_wave_switches'
for entity_id in hass.states.get(switches).attributes['entity_id']:
sensor = hass.states.get(entity_id).object_id
input_idPower = 'input_number.{}_power_daystart'.format(sensor);
sensor_idPower = 'sensor.{}_actueel'.format(sensor);
input_idUsage = 'input_number.{}_usage_daystart'.format(sensor);
sensor_idUsage = 'sensor.{}_totaal'.format(sensor);
#################################################################################
# Select Input_number and set value to the corresponding sensor
#################################################################################
# get sensor value
sensor_valuePower = hass.states.get(sensor_idPower).state
sensor_valueUsage = hass.states.get(sensor_idUsage).state
#
# and assign to input_number
hass.services.call(
'input_number',
'set_value',
{'entity_id': input_idPower,
'value': sensor_valuePower}
)
hass.services.call(
'input_number',
'set_value',
{'entity_id': input_idUsage,
'value': sensor_valueUsage}
)
Logger: homeassistant.components.statistics.sensor
Source: components/statistics/sensor.py:159
Integration: statistics (documentation, issues)
First occurred: 19:42:36 (1 occurrences)
Last logged: 19:42:36
sensor.today_temp_bom: parsing error, expected number and received None
Go back to whatever you had before if the new template integration isn’t working. It’ll be getting updates but it won’t get ‘restore state’ until thats implemented everywhere. And I don’t think that’s even being thought about.
Yah, and tag the statistics integration. This try catch’s net is too large
def _add_state_to_queue(self, new_state):
"""Add the state to the queue."""
if new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]:
return
try:
if self.is_binary:
self.states.append(new_state.state)
else:
self.states.append(float(new_state.state))
self.ages.append(new_state.last_updated)
except ValueError:
_LOGGER.error(
"%s: parsing error, expected number and received %s",
self.entity_id,
new_state.state,
)
I assume you just don’t want another integration Tom but the custom average component is much better for that sensor (as you can get the true average for the current day from midnight instead of a 24hr period - also the min temp for the last 24 hrs isn’t necessarily going to be the same as the low temp since midnight etc)
Have you set availability_template in your templates?
Defines a template to get the available state of the component. If the template returns true , the device is available . If the template returns any other value, the device will be unavailable . If availability_template is not configured, the component will always be available .
Yes, thanks.
I have tried all that. Availability_template, default, default(15).
availability_template: >
{% set id = states('sensor.guest_room_sensor_temperature') %}
{% set un = ['unknown','unavailable'] %}
{{id not in un and id is not none}}
Note I don’t get the error on the integration template sensors themselves, but on the min_max integration only.
trying the custom component Average doesn’t help:
2021-04-15 14:58:47 ERROR (MainThread) [custom_components.average.sensor] Unable to find an entity "sensor.guest_room_sensor_calibrated_temperature"
Snapshots always work, but the database can be corrupted if it’s mid write. So it ‘seems’ like the snapshot failed, when in reality it did not. If you separate your database from the snapshot, it never ‘fails’.
Also, moderation title has nothing to do with the ‘core team’. Moderators just manage quarrels on all the home assistant communities.
based on Hue integration sensor temperature (which all lose their states during template reload) how can I guard the above template sensor, so it wont cause havoc in other integrations using it.
As you can see Ive tried the availability sensor, but that wont help, because it merely Weill indicate the entity nit to be available, causing the identical distress in the min_max integration.
Thats why I thought a default value as in the release notes 2021.4 would help, like
With the latest 2021.4.4 update, I am having issues with the Google Assistant integration. When I ask Google to turn on or off lights, in the majority of cases, Google responds with “Sorry it looks like Home Assistant is unavailable right now” or “sorry I couldn’t reach Home Assistant”. No other changes have been made to my setup. I also tried reconnecting HA in the Google Home app to no avail.
EDIT: Even reverting to a 4.3 snapshot didn’t resolve this. I verified all settings and also the setup of the Google project as per the official instructions. Everything seems to be in good order. Am I the only one with this issue?
In your availability_template do you also check for input_number.temp_calibration availability? because you need to check availability for all entities used in the template
Thanks for the reassurance. I always wait a few days to upgrade to let the major bugs get answered, trusting that I can always restore a prior snapshot if something goes wrong.
I am even more apprehensive when the update thread accumulates over 600 posts in just a week.
If you read the breaking changes, the upgrade typically always goes smoothly. Most of us run betas and find the issues before release (i.e. before this thread).