Hi,
I defined a custom sensor for WiFi location tracking and I was trying to add an additional custome sensor for overall location which uses the previously created custom sensor (WiFi) and the already available tracker sensor (GPS).
The problem is that reloading the configuration now I can find only the last custom sensor created the WiFi one seems not available anymore to be used (i.e. I had in the dashboard some already created cards that now show this sensor as unavailable)
Below the code in which with the second sensor the aim is to rely also on the GPS for reinforcing “Location X”. At the end only the Device location presence sensor is available for use the other no more
This is likely related to the method you are using include/merge your files. The sensor key should be able to accept a list, so just remove the second - sensor: then reload Template entities or restart HA.
thanks for the quick feedback, I exploit it to detail better, looking at the configuration below, I started having only the sensor 1 and 3 (WiFi related) and it worked. Then I added the sensor 2 and 4 and starting from that time only sensor 2 and 4 are available, 1 and 3 no more.
Btw I tried also to follow your instructions (as per the second configuration) for sensor 1 and 2 with the list and in this case I cannot se neither sensor 1 nor sensor 2.
I guess it’s just when you access them via states.sensor.my_sensor.last_changed
Did you check if state_attr, is_state behave the same way? It would be a very Home Assistant thing for one function to behave differently to the others.
Sorry, but this works, it’s the old sensor the WiFi related that is not apeearing anymore. The new one that is using in the logic the previous sensor (WiFi) combining WiFi with GPS data works.
You would likely be better off just setting up an automation to push the location name to a device tracker entity using the device_tracker.see service than setting up all these sensors…
No. You believe it works, but it doesn’t. It is simply impossible - IF it is the same as the code you posted. Because states(‘device_wifi_location_presence’) will ALWAYS return an empty string. It will never reference the state of the sensor you created before this one. it MUST use sensor.
This sensor is ALWAYS being updated based solely on the device_tracker.