I use places just to show the country I am in in the sensor value, which works perfectly. Recently, I started to process also an attribute of that sensor, place_type. However, even though my location changes several types, the attribute(s) seem to stick. When I add the place_type to the Display Options, it updates the attributes quite fast.
To reproduce:
Create country sensor with the display options place[country_code]
Use fake GPS or other mock location tools to set your location
HA changes the location correctly from home to away
Places sensor sticks to the old location, which is correctly CZ, but also the attributes do not change
I assume the issue is because I do not request the attribute to be updated, the Display Options just contain the country code.
The log also show it reverts the values, although the response from OSM processed my home address and not Profi Auto CZ.
2024-06-01 23:30:20.949 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) Keeping initial last_place_name
2024-06-01 23:30:20.949 INFO (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) last_place_name: Profi Auto CZ
2024-06-01 23:30:20.949 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) Initial Advanced Display Options: place[country_code]
2024-06-01 23:30:20.949 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) [get_option_state] State: None
2024-06-01 23:30:20.949 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) [get_option_state] State: CZ
2024-06-01 23:30:20.949 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) [get_option_state] State after incl/excl: CZ
2024-06-01 23:30:20.950 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) [adv_options] Updated state list: ['CZ']
2024-06-01 23:30:20.950 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) New State from Advanced Display Options: CZ
2024-06-01 23:30:20.950 INFO (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) No entity update needed, Previous State = New State
2024-06-01 23:30:20.951 DEBUG (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) Reverting attributes back to before the update started
2024-06-01 23:30:20.951 INFO (SyncWorker_42) [custom_components.places.sensor] (Country Sensor Alex) End of Update
To confirm my theory, I removed place_type again from the Display Options and moved the position around, but as before it did not update the attributes anymore.
Unfortunately, the full log is some work to sanitize before publishing it online, but I can send it to you by PM/mail.
I can live with the workaround, if I process an attribute later or cut of 3 digits and process it from the sensor value is not a big deal in my case.
My bug is quite a specific edge case.
I use places just to show the country I am in in the sensor value, which works perfectly. Recently, I started to process also an attribute of that sensor,
place_type
. However, even though my location changes several types, the attribute(s) seem to stick. When I add theplace_type
to the Display Options, it updates the attributes quite fast.To reproduce:
place[country_code]
I assume the issue is because I do not request the attribute to be updated, the Display Options just contain the country code.
The log also show it reverts the values, although the response from OSM processed my home address and not Profi Auto CZ.
To confirm my theory, I removed
place_type
again from the Display Options and moved the position around, but as before it did not update the attributes anymore.Unfortunately, the full log is some work to sanitize before publishing it online, but I can send it to you by PM/mail. I can live with the workaround, if I process an attribute later or cut of 3 digits and process it from the sensor value is not a big deal in my case.