I am looking for a Homeassistant automation of an action to copy the value of attributes of an (arbitrary) existing entity into another entity. Something like:
switch.homewizard.attributes.state = sensor.homewizard.attributes.state. So, an exchange between the homewizard sensor platform and the homewizard switch platfrom
I could not find a standard service call for this process. I am not yet very experienced with Homeassistant, so I would appreciate any guidance.
Background:
In my Homeassistant configuration I have created 2 platforms to interface with the Homewizard box which I use here as a hub: one platform for the sensors and a second for the switches. Both get their update data from identical request.get calls to the Homewizard box. This setup allows me to control about 42 switches and 17 sensors (including thermometers, hygrometers and alarm devices). All is working reasonably well in Homeassistant, apart from occasional timeouts in the scanning process which I had to timeout.
In the setup and updating process of Homeassistant each platform gets all Homewizard data using request.get(url, timeout=…), which means that the same information is always asked for twice (only twice, because within each platform I keep these data for about 10 sec so that all 42 switches - or 17 sensors - can be updated with the same data). This is done in each platform using an intermediate object HomewizardData which contains all information that was retrieved from the initial and update calls to the Homewizard. In order to make the content of these 2 objects available as Homeassistant entities I have created the sensor.homewizard and the switch.homewizard.
Now I’d like to reduce the load on the network and the Homewizard box by avoiding the request.get call for the switches. This could be done by copying the data from the sensor.homewizard entity and loading it into the switch.homewizard entity. This entity makes the data then available at the lower level to the intermediary HomewizardData object from which the 42 switches derive their content.
Then only one request.get call is needed for per update scan.