Hi,
I have simple mqtt lights and switches controlled from HA by arduino mega + w5100 shield. On arduino I have simple program which subscribes to certain topic and switches on/off relay switch.
My light can be triggered by pushbutton or motion sensor (both mqtt sensor in HA) - automation is done by my AppDaemon script. I would like to set additional attributes (which would be updated by AppDaemon) to my light/switch such as :
Hi, I haven’t tried this yet - will it give me attributes I can see in Dev-state card or in entity property ? And additionally, those attributes will have nothing to do with my Arduino controller, so they do not have to be mqtt related. what I want is just to be able to get attribute from given switch, not new extra template sensor or whatever which I would have to hardcode/pass to appdaemon script or hass gui somehow.
You tagged this thread with MQTT and stated you had “simple mqtt lights and switches” so naturally I was led to believe you wanted a way to do it that involves MQTT Lights, Switches, Sensors, etc. They have the ability to be assigned custom attributes via their json_attributes topic.
I’m not familiar with AppDaemon’s capabilities but I’ll wager it can call mqtt.publish to post updates to json_attributes. However, if you don’t want to use MQTT publishing and prefer to create new attributes, and write to them, using AppDaemon … I don’t know how to do that. You may wish to search the AppDaemon category for a solution. I found this thread which may be relevant:
Thank you, will read post you gave.
I marked mqtt as what i would like to have (actually what I think I would like to have) is to configure mqtt switch, and then somehow add some attributes to this entity which would be only controlled by HA/AppDaemon. I imagine it would look like (pseudocode):
platform: mqtt
Command topic : some topic
State topic : some other topic
Name : name
Extra attributes:
name : last_switched_by
Default : none
Type: text/int/boolean