Hardware: Orangepi 3 LTS
openHAB version: 3.4.3
I am calling the Astro binding like so:
This produces the following:
I would need the datetime to be in the following format
Tue May 02 2023 00:00:00 GMT+0300 (EEST)
Is it possible to format the output of the Astro binding to conform to the latter format? If so, how can I do that?
May 1, 2023, 7:29pm
all DateTime Items use ISOP8601 format (if JS Scripting) or an RFC format in all other cases (the main difference is the RFC uses the timezone name instead of an offset).
No, because the Astro binding has nothing to do with that.
Where do you want this format? In a widget on MainUI or a sitemap? If so, set the Item’s State Description metadata Pattern field following
Items | openHAB and Formatter (Java SE 11 & JDK 11 ).
I am “developing” the heat pump control system created by
@masipila Control a water heater and ground source heat pump based on cheap hours of spot priced electricity - #17 by masipila. The existing code calculates needed heating hours based upon average outdoor temperature and windchill. I would like to add compensation for passive heating caused by sunshine, too. I try to keep my house indoor temperature at 19-20 C, but on sunny days the temperature rises to 25 C. Hence, I would like to reduce the hours the heat pump is running on sunny days.
You can find the actual implementation at
#13 of this megathread. The actual code I am trying to interact with is nibe.js that can be found under " in 8. HELPER MODULES USED IN THE SCRIPT ACTIONS ABOVE #13 of that thread.
The script is using a midnight to midnight timeslot to calculate average temperature over the day. I have copied the function with the intention of calculating average sunshine hours per day based upon a) the cloudiness forecast from the finnish national meterorolgical bureau FMI and b) the sunset and sunrise times from the Astro binding.
May 2, 2023, 1:19pm
I’m not going to analyze all of the code posted there but from what I can see:
everything is written in GraalJS JS Scripting rules
the code is packaged as a node module
You don’t need a different string representation of the Astro DateTime, you need to convert the DateTimeType which is the state carried by a DateTime Item to a JS Date Object.
var sunriseZDT = items.getItem('sunRise').rawState.getZonedDateTime(); // note will fail is Item is NULL or UNDEF
var sunriseDate = new Date(sunriseZDT.getYear(), sunriseZDT.getMonthValue() ...