Keep me posted - not sure why it would affect any of that, but if there are negative results will be very interested!
Automation is working perfect now for 4 hours. Was at home so was able to try the sensors and automation many times. Now install the integration again and see what happen.
After install it again. Everything seems work correct now
Your component is working great.
Is there a way that the format of the date and time could be changed or configured? I live in Germany and it would be great if the date could be in the correct format and the time could have 24h.
Or could the UTC launch date be added as an attribute? That way I could create template sensors for that like I had for the rest sensors.
For now Iāve changed the format for the date and time in the sensor.by but that isnāt really great.
I just noticed that a new device for the component is added after every reboot of HA.
But only the first device has all the entities. The other ones are empty.
Great idea - will ad the UTC launch date and the Unix launch date to the next version as attributes.
Yeesh! Donāt know why I didnāt catch that one! Will have to do a bit of digging, but will release a new version once I squash that.
OK - I have pushed an update which adds the UTC and UNIX as attributes on the launch date and removes the device registry since it is being duplicated - not really necessary for this integration anyway so figured this was just as easy.
You will want to:
- Uninstall the integration from Configuration -> Integrations
- Install the update through HACS (or manually)
- Do a cache-clearing refresh in Chrome (Ctrl+F5)
- Reboot Home Assistant
- Reinstall the integration in Configuration -> Integrations
Please let me know if this meets the need!
Tim
If you installed through HACS you may need to click the three dots and click Update Information to force it to check for an update.
How frequently does SpaceX update the values?
Usually every time there is a change / after a launch. Iāve noted that they havenāt updated since the launch Sunday though. Out of characterā¦ normally is more up to date.
Thank you. This will help me keep track of whatās going on.
Thanks for the quick response.
Iāve updated the component and added it again. The UTC and UNIX dates are now available and on the integrations page there are only the entities listed.
Thank you very much.
Updated by request to include the latest launch information in sensors as well. For some inspiration on how to use this data (and an enhance main card which includes a link to the Video Link to watch a launch from the mission patch, here is a Lovelace layout for it:
cards:
- content: >-
<table ><tr><td> <a href="{{
states.sensor.spacex_next_launch_mission.attributes.video_link }}">{% if
states.sensor.spacex_next_launch_mission.attributes.mission_patch != "" %}
<img src="{{states.sensor.spacex_next_launch_mission.attributes.mission_patch}}" width=250 title="Watch Launch">
{% endif %}</a></td> <td>{{
states.sensor.spacex_next_launch_mission.attributes.details }}
</tr></table>
title: Next Launch
type: markdown
- entities:
- entity: sensor.spacex_next_launch_rocket
name: Rocket
- entity: sensor.spacex_next_launch_mission
name: Mission
- entity: binary_sensor.spacex_next_launch_confirmed
name: Confirmed
- entity: sensor.spacex_next_launch_day
name: Day
- entity: sensor.spacex_next_launch_time
name: Time
- entity: sensor.spacex_next_launch_site
name: Site
type: entities
- type: entities
title: Latest Launch
entities:
- entity: sensor.spacex_latest_launch_rocket
name: Rocket
- entity: sensor.spacex_latest_launch_mission
name: Mission
- entity: sensor.spacex_latest_launch_day
name: Day
- entity: sensor.spacex_latest_launch_time
name: Time
- entity: sensor.spacex_latest_launch_site
name: Site
show_header_toggle: false
- type: markdown
content: >-
<center><a href="{{
states.sensor.spacex_latest_launch_mission.attributes.video_link }}">Watch
Latest Launch</a></center>
- entities:
- entity: sensor.spacex_starman_speed
- entity: sensor.spacex_starman_distance
show_header_toggle: false
title: Starman Tesla Roadster
type: entities
title: SpaceX
type: vertical-stack
Nice !!! Updated, use new card part seems very nice!
Maybe you can do something with those errors:
2020-09-04 10:25:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:25:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:26:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:26:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:27:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:27:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
2020-09-04 10:28:16 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.spacex_next_launch_mission fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 454, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/spacex/sensor.py", line 168, in async_update
self.attrs["details"] = launch_data.get("details")[0:255]
TypeError: 'NoneType' object is not subscriptable
Those are actually already fixed. Please check for an update in HACS community for the integration. You may need to click the three dots and select Update Information if it doesnāt already show update available.
If you installed manually you willl need to update the files in your custom component manually as well from the GitHub repository.
I have the 004 version. After that I post thisā¦
Something wrong then on your system. Maybe uninstall it and reinstall. The error you posted was fixed in 003 (doesnāt appear on my system) and the line numbers in the error donāt line up to 004 either.
Will try it later. Have to go work now!
hello, not sure what is going wrong here but when I look for the repository on HACS, nothing appears. Any idea what is going on there?