Next solution is valid for me: example adding nfc_card
attribute to person
domain.
Inside configuration.yaml
# Adding attributes to persons
homeassistant:
customize_domain:
person:
nfc_card: ""
# Load python scripts
python_script:
Create: python_scripts/set_cards.py
#---------------------------------
# Set nfc_card attribute to person
#---------------------------------
inputEntity = 'person.fquinto'
inputStateObject = hass.states.get(inputEntity)
inputState = inputStateObject.state
inputAttributesObject = inputStateObject.attributes.copy()
inputAttributesObject['nfc_card'] = '12345678'
hass.states.set(inputEntity, inputState, inputAttributesObject)
Or another script like this: How to manually set state/value of sensor? - #3 by rodpayne
References