I have an automation to increase the volume by setting the volume instead of increasing (default increase is way too much for my tv). I drew the configuration from this suggested answer: Media Player Volume Sensitivity - #4 by Burningstone
However, the float errors out: Template warning: 'float' got invalid input 'None' when rendering template '{{ state_attr('media_player.samsung_tv, 'volume_level') | float + 0.05 }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1
So the state_attr is erroring out and HA is substituting 0, which effectively set’s my volume at a flat float of .05. Any suggestions?
Ok, so the initial automation had the wrong name, so i fixed it to what is posted above. Now, no logs are being generated, but the volume is still being set to .05
Logger: homeassistant.components.automation.increase_volume_05
Source: components/automation/__init__.py:514
Integration: Automation (documentation, issues)
First occurred: 2:35:04 PM (7 occurrences)
Last logged: 3:47:05 PM
Error while executing automation automation.increase_volume_05: Error rendering data template: Result is not a Dictionary
Error while executing automation automation.increase_volume_05: required key not provided @ data['volume_level']
Error while executing automation automation.increase_volume_05: expected float for dictionary value @ data['volume_level']
It’s available now (re-added in the gui) and the run is still giving this error:
Logger: homeassistant.components.automation.increase_volume_05
Source: components/automation/__init__.py:514
Integration: Automation (documentation, issues)
First occurred: 2:35:04 PM (10 occurrences)
Last logged: 6:36:16 PM
Error while executing automation automation.increase_volume_05: Error rendering data template: Result is not a Dictionary
Error while executing automation automation.increase_volume_05: required key not provided @ data['volume_level']
Error while executing automation automation.increase_volume_05: expected float for dictionary value @ data['volume_level']
Have you had any more success with this? I would suggest for testing purposes to forget the automation for the moment and just work on getting the value to display in the template editor under developer tools. This will help you troubleshoot how the value is displayed and to be sure that you can get the data. I’ve done some testing on my own side and can return data from an attribute in the same way that you are trying.
When you are testing this, is the tv playing media? I’m not sure if the volume level attribute will be populated unless media is playing. Might be worth double checking as this could be a potential cause of the error.