Attempting to query the HA API according to the docs. I wish to pass both an end_time
and filter on filter_entity_id
. However the following results in an error:
now_encoded = urllib.parse.quote_plus(datetime.now().isoformat())
query = '{}api/history/period/{}?end_time={}?filter_entity_id={}'.format(url, lookback_period, now_encoded, entity)
response = get(query, headers=headers).json()
Out[59]:
{'message': 'Invalid end_time'}
However if I remove the filter_entity_id
then I don’t get any errors, but data is returned for all of my entities (slow!). Therefore there must be a problem with the way I am stringing end_time
and filter_entity_id
together. Any ideas?