I am trying to create a rest API to call weather based on my location. but the issue with this rest sensor is that I get the error that lat/long is malformed.
If I set q=30,-100 for example, in the url, it works and returns valid data
If I set
params:
q: 30,-100
it returns malformed lat/long
And ultimately I want to use the template to get q dynamically, but it returns invalid lat/long from the api both inline and as a param
is there a workaround for this annoying template bug?
# Location Key from Starlink
- platform: rest
name: PTH REST Weather Key
resource: "http://dataservice.accuweather.com/locations/v1/cities/geoposition/search?apikey=xxxxxxxx&q={{ state_attr('device_tracker.pth_starlink_device_location', 'latitude')|round(2) }},0"
#{{ state_attr('device_tracker.pth_starlink_device_location', 'latitude')|float(default=0)|round(2) }},{{ state_attr('device_tracker.pth_starlink_device_location', 'longitude')|float(default=0)|round(2) }}
value_template: "{{ value | tojson | truncate(200) }}"
json_attributes:
- Version
- Type
- LocalizedName
- GeoPosition
scan_interval: 5