First of all i wanna say thank you for the lots of help here. I’m not a programmer but i can find almost everything what i need to set up HA (pws, inverter, mqtt, etc…)
Now i try to find out how many airplane is above an exact location in real time.
Opensky-network is a good choice (and HA has this integration) but i can not setup scan_interval (HA ignore this order) and my acces limit from opensky will be full soon and my ip restricted. So i read community forum for hours in the last some days and i find an almost working solution:
This give me lots of aircraft data in the ‘states’ attribute and them all are separated with ‘- -’ characters, so my idea is to count theese characters.
But this do not give me back anything usable. I try dozen and dozen json settings but i have no new idea, Maybe the code abowe is a great stupidity, as i write i am not a programmer just trying to find the logic in your earlyer advices…
You have already parsed the original JSON with your rest sensor. The dashes you’re seeing are the ones showing you are dealing with lists (that’s what it looks like it in YAML). The double dashes are because that API returns a list of lists. You only care about the outer list, so you just want to count that.
Thank you for your fast answare.
I try your advise but unfortunatelly opensky banned me today, so i renew my ip but it did not help. So I rename the sensors (rest, temp) but now the rest did not appear under entities after several restart. So later i’ll try restart again HA and keep trying. Be back if i see any change.
log:
Logger: homeassistant.helpers.template_entity
Source: helpers/template_entity.py:356
First occurred: 08:40:30 (1 occurrences)
Last logged: 08:40:30
TemplateError(‘TypeError: object of type ‘NoneType’ has no len()’) while processing template ‘Template(“value_template: {{ state_attr(‘sensor.500repcsirest’, ‘states’) | count }}”)’ for attribute ‘_attr_native_value’ in entity ‘sensor.500repcsitemp’