Is it possible to get the location sunrise and sunset time within the device type?

I want to get the reading from my energy meter at those specific times. I have a solar system and want to calculate daily productions.

I also want to programmatically change the configuration at these times so that the energy meter sends negative (for generation) readings in the day and positive (for usage) readings at night. I am using the Aeon v2 energy meter and it is one directional and can’t determine positive and negative on it’s own.

Thank you.

1 Like

For this situation I would add a second HEM to the solar output, if you already have one on the mains. Then, I would create a SmartApp that subscribed to both of the devices and did the calculations at sunrise and sunset. This would give you the most accurate readings of production and consumption

If you still want to do this with a single HEM, you can do this within the device type.

Sry for not explaining it better. I am not currently looking at usage from my house. The HEM is on a subpanel dedicated only to solar. I have both string and micro inverters so I am using the HEM to get totals and peak production for the entire system. The main reason I got this is to prove production issues for warranty purposes when I am told it is a communication error between the inverter and gateway.

In the night the inverters and gateway even though quite little still pull power from the grid. Can you tell me how do I check local sunrise and sunset times within the device type? I tried getSunriseAndSunset and location.sunrise but both gave me errors.

Thank you

You will need to move the sunrise/sunset logic into a SmartApp. I don’t have my HEM to test with yet, but this should be split out from the device type. You could do a service manager SmartApp that would allow these values to be displayed in a child device, but that is another layer of complexity. I am asking around as I have never needed to pull sunrise/sunset into a local device.

@Jim @Dave any thoughts?

1 Like

Just add a custom “day/night” Attribute / Command to the HEM Device Type Handler and have a SmartApp call this Command at Sunset and Sunrise :sunrise:!

Let me know if you want details…

Yes please. Do you have an example of this in any other app or something similar? I only got my hub a couple weeks ago and this is my first time attempting any of this.

Thank you