question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sun_Phase Sensor not updating correctly

See original GitHub issue

For a couple of days my sun phase sensor has been failing to update correctly in the morning.

It is just missing out some of the phases, I still get updates at noon and in the evening, but its staying at night until solar noon. Error log:

This error originated from a custom integration.

Logger: custom_components.sun2.sensor
Source: custom_components/sun2/sensor.py:125
Integration: sun2
First occurred: November 4, 2022 at 23:52:43 (6 occurrences)
Last logged: November 4, 2022 at 23:52:43

London Sun Phase: Failed to find the time at elev: -12.000
London Sun Phase: Failed to find the time at elev: -6.000
London Sun Phase: Failed to find the time at elev: -4.000
London Sun Phase: Failed to find the time at elev: -0.833
London Sun Phase: Failed to find the time at elev: 6.000

my .yaml configuration:


- platform: sun2
  entity_namespace: London
  latitude: #########
  longitude: ########
  time_zone: Europe/London
  elevation: 11
  monitored_conditions:
    - sunrise
    - sunset
    - sun_phase
    - dawn
    - dusk
    - solar_noon
    - solar_midnight
    - daylight
    - night

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
rlewis187commented, Nov 8, 2022

Ok, looks like you fixed it:

Heres my logs:


2022-11-08 23:52:57.014 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: tL = 2022-11-08 23:52:57+00:00/-54.563, cur = 2022-11-08 23:52:57+00:00/-54.563, tR = 2022-11-09 11:52:54+00:00/20.895, rising = True
2022-11-08 23:52:57.015 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -18.000: t0 = 2022-11-09 05:16:29+00:00/-18.763, t1 = 2022-11-09 05:26:29+00:00/-17.236 -> est = 2022-11-09 05:21:29+00:00/-17.999[ +0.001]
2022-11-08 23:52:57.016 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -12.000: t0 = 2022-11-09 05:56:04+00:00/-12.752, t1 = 2022-11-09 06:06:04+00:00/-11.252 -> est = 2022-11-09 06:01:05+00:00/-11.998[ +0.002]
2022-11-08 23:52:57.017 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -6.000: t0 = 2022-11-09 06:36:42+00:00/ -6.729, t1 = 2022-11-09 06:46:42+00:00/ -5.276 -> est = 2022-11-09 06:41:43+00:00/ -5.999[ +0.001]
2022-11-08 23:52:57.018 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -4.000: t0 = 2022-11-09 06:50:32+00:00/ -4.722, t1 = 2022-11-09 07:00:32+00:00/ -3.280 -> est = 2022-11-09 06:55:33+00:00/ -3.999[ +0.001]
2022-11-08 23:52:57.019 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -0.833: t0 = 2022-11-09 07:11:02+00:00/ -1.744, t1 = 2022-11-09 07:21:02+00:00/ +0.022 -> est = 2022-11-09 07:16:11+00:00/ -0.935[ -0.102]
2022-11-08 23:52:57.019 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -0.833: t0 = 2022-11-09 07:16:11+00:00/ -0.935, t1 = 2022-11-09 07:21:02+00:00/ +0.022 -> est = 2022-11-09 07:16:42+00:00/ -0.847[ -0.014]
2022-11-08 23:52:57.019 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = -0.833: t0 = 2022-11-09 07:16:42+00:00/ -0.847, t1 = 2022-11-09 07:21:02+00:00/ +0.022 -> est = 2022-11-09 07:16:46+00:00/ -0.836[ -0.003]
2022-11-08 23:52:57.022 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: trg = +6.000: t0 = 2022-11-09 08:05:45+00:00/ +5.404, t1 = 2022-11-09 08:15:45+00:00/ +6.594 -> est = 2022-11-09 08:10:46+00:00/ +6.004[ +0.004]
2022-11-08 23:52:57.022 DEBUG (MainThread) [custom_components.sun2.sensor] London Sun Phase: _update time: 0:00:00.009470

Many thanks for sorting this out, it is a key part of all my lighting controls so is very important to me.

1reaction
pnbrucknercommented, Nov 7, 2022

I found the problem. I’m working on a fix. I hope to release a beta version with the fix soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command line sensor not updating - Configuration
I have this very simple command line sensor: - platform: command_line name: ... But then it will not update the sensor in regular...
Read more >
Multipurpose sensor not updating - Devices & Integrations
What is everyone experience with the multi purpose sensor? Mine would update the status and temperature and then just stop.
Read more >
Update record not working in discovery sensor - ServiceNow
Solved: I am trying to update couple of field values for ip switch from an SNMP sensor. The idea is to compare the...
Read more >
What to do if a Sensor is not Accepting a Configuration Change
Power cycle the sensor once more. Confirm the gateway's firmware is up to date. Check to see if the gateway is due for...
Read more >
Sensor not updating/ not seen alert - La Crosse Technology
Sensor Updates/No Seen Alert Start by:Select the Account menu item on the home page of the app/website and make sure that the gateway...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found