Hi, you'll find here some personal and spare time projects of mine.
Additional stats here
Python script to handle state and attributes of existing sensors and entities
License: MIT License
Hi, you'll find here some personal and spare time projects of mine.
Additional stats here
Trying to set the friendly name at an input_select does nor work.
Using:
service: python_script.hass_entities
data:
action: set_attributes
entity_id: input_select.home
attributes:
friendly_name: "abcd"
throws
hass_entities error
An unhandled error has occurred.
'NoneType' object is not callable
dooing is directly in HASS works, but i need it in an automation!
What is your question
I have successfully used your script to change states/attributes of items in my config. However, when I try to change the name
attribute of a timer, it simply doesn't happen.
YAML configuration
# This is my automation:
- service: python_script.hass_entities
data:
action: set_attributes
entity_id: timer.boiler_viktors_office
attributes:
- name: "Currently"
# This is my lovelace item:
- entity: timer.boiler_viktors_office
name: Time remaining
tap_action: none
# This is my timer:
boiler_viktors_office:
Screenshots
If applicable, add your screenshots here.
Version
What is the version of the script?
v1.1.0
Additional information
In the logs I didn't find anything obvious...
** Bug **
When adding this repository as a custom repository in HACS, the process fails with the message;
Repository structure for v1.1.0 is not compliant
(HACS version 1.24.5 - current)
To Reproduce
Attempt to add the repository to HACS as a custom repository
(Note, the repository is not found in the base HACS components list
Expected behavior
The repository is added to hacs
YAML configuration
# NA
Hi there,
I recently discovered your very helpful script to set states and/or attributes. So, thanks a lot!!
I'm looking for a way to use this (or customized) script) to do a simple calculation to set the new state.
But, I'm an enthusiastic but not yet highly skilled HA user. ;-)
I have a sensor that counts the motions from a motion sensor:
sensor:
But sometimes I have a fake count (in this case by restarting HA).
So in that case I like to correct this by subtracting the value by 1 (from the state (string value)) .
So the new state should be the value of sensor.beweging_kidsroom minus 1
Is that possible with (some change/addition to) your script ?
I tried things like:
service: python_script.hass_entities
data:
action: set_state
entity_id: sensor.beweging_kidsroom
state: {{ states.sensor.beweging_kidsroom.state | int -1 }}. # with and without quotes
But yet without luck. I also tried to replace the state by using another state (also with no luck)
..
state: {{ states.sensor.beweging_slaapkamer.state }}. # with and without quotes
Maybe you are willing to help me to solve my issue. Or maybe you have a tip or other idea how to solve it.
Thanks in advance for a reply.
Good luck!
Best Regards,
Nico
I'm interested in using this script but I'm not succeeding, I always get the following error: [homeassistant.components.python_script.hass_entities.py] Required parameter 'action' is missing. with following HA script configuration. Can you give me a hint? Thank you.
YAML configuration
prova_python_script:
alias: prova python script
sequence:
- service: python_script.hass_entities
data:
service_data:
action: set_state
entity_id: sensor.temperatura_piano_sopra
state: 30
log_enabled: true
mode: single
Screenshots
If applicable, add your screenshots here.
Version
latest
Additional information
Add any other relevant additional information here.
What is your question
Can you please share one example of using the script in an automation or script.
YAML configuration
# paste your configuration here
`'1596141541557':
alias: '###New Script Off'
sequence:
- data:
action: set_state_attributes
entity_id: binary_sensor.neo_coolcam_door_sensor
state: 'off'
service: python_script.hass_entities``
**Screenshots**
If applicable, add your screenshots here.
**Version**
What is the version of the script?
I'm using version 1.1.0
**Additional information**
I was able to get it to work from lovelace but from an automation and script It's not working for meץ
What is your question
When I create a attribute on a binary_sensor that triggers the creation of the attribute, the attribute disappears after another state change of the binary sensor.
Is this by design? I would like the attribute to be permanent.
YAML configuration
---
alias: Oprit Hue
id: oprit_hue
trigger:
- platform: state
entity_id: binary_sensor.hue_reserve_motion_lumi
from: "off"
to: "on"
action:
- service: python_script.hass_entities
data:
action: set_attributes
entity_id: binary_sensor.hue_reserve_motion_lumi
attributes:
- start: "{{ as_timestamp(now()) |float(0) }}"
Version
v1.1.0
Additional information
Logfile info:
2022-05-04 10:44:50 INFO (SyncWorker_2) [homeassistant.components.python_script] Executing hass_entities.py: {'log_enabled': True, 'action': 'set_attributes', 'entity_id': 'binary_sensor.hue_reserve_motion_lumi', 'attributes': [{'start': 1651653890.053345}]}
2022-05-04 10:44:50 DEBUG (SyncWorker_2) [homeassistant.components.python_script.hass_entities.py] Python Script: hass_entities.py -> START of action: set_attributes
2022-05-04 10:44:50 DEBUG (SyncWorker_2) [homeassistant.components.python_script.hass_entities.py] Entity: 'binary_sensor.hue_reserve_motion_lumi' -> New attribute 'start': '1651653890.053345'
2022-05-04 10:44:50 DEBUG (SyncWorker_2) [homeassistant.components.python_script.hass_entities.py] DONE -> Attributes set for entity 'binary_sensor.hue_reserve_motion_lumi'
2022-05-04 10:44:50 DEBUG (SyncWorker_2) [homeassistant.components.python_script.hass_entities.py] Python Script: hass_entities.py -> END of action: set_attributes
How would i set the attribute of en entity from its state
YAML configuration
alias: Tasmota Firmware Update Notification
description: ''
trigger:
- platform: time
at: '15:34:00'
condition: []
action:
- service: python_script.hass_entities
data:
action: set_attributes
entity_id: sensor.tasmota_latest_version
attributes:
- latest_version: '{{(states.sensor.latest_tasmota)}}'
mode: single
**Screenshots**
If applicable, add your screenshots here.
**Version**
What is the version of the script?
**Additional information**
Add any other relevant additional information here.
Cannot add this repository to HACS. Error message in title.
Latest HACS and HASS.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.