Comments (24)
Can’t you use the time zone setting as set in HA? I have the same issue since I work on a different continent from where my house is.
thanks for the hint. that might be feasible and might make the configuration/implementation easier.
i'll have a look into it in the next couple of days
from clock-weather-card.
If it doesn't add too much complexity, I'd love the ability to specify any sensor for the date/time. I have a wall panel where I'd like to display the time and weather in different cities where I have family. I can currently do this with the weather since I can specify any sensor, but I can't for the time.
from clock-weather-card.
thanks for the request.
when i initially implemented the card, i realised that sensor.time
is optional in home assistant and must be configured explicitly.
hence i could not rely on the sensor being available in every HA instance. thus i decided to get the time from the current browser.
what i could do though, is to allow providing an optional property time_sensor: sensor.time
and read the current time from there. but since sensor.time
only holds the time, i would additionally need sensor.date
to show the weekday and the corresponding date, which makes the configuration a bit clunky since a user would have to configure both values time_sensor
and date_sensor
to make it work. and if a user only configures either property, the card will not work properly
from clock-weather-card.
Much prefer the suggestion to use any sensor - this allows more flexibility. Is there a way to have a default that can be overridden?
from clock-weather-card.
I would love to have this as well. In my case i use the clock on a screen device that is cut from the internet, and has no reliable internal clock. I was hoping that could use the time of the HA.
from clock-weather-card.
It's odd that sensor.time
is not enabled by default in HA, but anyway...
I see how it makes the config a bit clunky. Can you set defaults so if either time_sensor
or date_sensor
were missing something would still be displayed?
from clock-weather-card.
I use LibreWolf Browser which only uses GMT 0. I would really like an an option to define a custom offset or timezone
(get browser time zone, calculate difference to user setting and set new time)
from clock-weather-card.
I also would like to be able to set my home time zone for the same reasons. I’m away from home and my HA should show the time at my home and not my local time where I am offsite.
from clock-weather-card.
Can’t you use the time zone setting as set in HA? I have the same issue since I work on a different continent from where my house is.
from clock-weather-card.
@pkissling any development on this? Would really appreciate to have the host machine local time option. :) Thank you so much for this card!
from clock-weather-card.
i currently use this userscript with e.g. violentmonkey:
change YOUR_DOMAIN
and germanTimeZoneOffset
// ==UserScript==
// @name Deutsche Zeitzone
// @namespace Violentmonkey Scripts
// @match https://YOUR_DOMAIN
// @version 0.1
// @description Überschreibt das Date-Objekt, um die deutsche Zeitzone zu verwenden
// @author Me
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const today = new Date();
const month = today.getMonth() + 1; // Januar ist 0, daher +1
const day = today.getDate();
const hour = today.getHours();
let isSummerTime;
if (month > 3 && month < 10) { // Sommerzeit gilt von April bis September
isSummerTime = true;
} else if (month === 3 && day >= 29 && hour >= 2) { // letzter Sonntag im März um 2 Uhr
isSummerTime = true;
} else if (month === 10 && day <= 25 && hour < 3) { // letzter Sonntag im Oktober um 3 Uhr
isSummerTime = true;
} else {
isSummerTime = false;
}
const germanTimeZoneOffset = isSummerTime ? -120 : -60; // Deutsche Zeitzone ist UTC+1 (+2 während Sommerzeit)
const originalDate = Date;
function getGermanDate(...args) {
if (args.length === 0) {
const now = new originalDate();
return new originalDate(now.getTime() + (now.getTimezoneOffset() - germanTimeZoneOffset) * 60000);
} else {
return new originalDate(...args);
}
}
// Überschreibe das Date-Objekt
const newDate = function(...args) {
return getGermanDate(...args);
};
// Kopiere die Prototypen und statischen Methoden
Object.setPrototypeOf(newDate, originalDate);
Object.setPrototypeOf(newDate.prototype, originalDate.prototype);
for (const prop of Object.getOwnPropertyNames(originalDate)) {
if (typeof originalDate[prop] === 'function') {
newDate[prop] = originalDate[prop].bind(originalDate);
} else {
Object.defineProperty(newDate, prop, Object.getOwnPropertyDescriptor(originalDate, prop));
}
}
// Date-Objekt überschreiben
Date = newDate;
window.Date = newDate;
})();
from clock-weather-card.
@pkissling any development on this? Would really appreciate to have the host machine local time option. :) Thank you so much for this card!
i did the code changes today (introducing an attribute use_browser_time
which can be set to false
to use time from time_zone
configured in HA.
i will have to do some testing tomorrow and will afterwards release a new version
@dunxd @rad2000 if you want a feature to configure a dedicated time and date sensor, feel free to create a new issue 👍🏻
from clock-weather-card.
@pkissling thank you so much! 😎
from clock-weather-card.
Hi again. Now it seems there's a 12h difference between Ha time and the one your card displays. See screenshot attached. Perhaps some error in the background? Appreciated the efforts here @pkissling. 😎😉
from clock-weather-card.
from clock-weather-card.
Both time format gives me the wrong time by +12h
from clock-weather-card.
Both time format gives me the wrong time by +12h
Can you please give additional information?
Your current time zone (browser), your current time, the time zone configured in HA and the browser you are using. i want to try to reproduce the problem
from clock-weather-card.
My current time zone is UTC+7 (12:42lt). My HA host is UTC+1(0642lt). The card shoud be showing 0642lt but it's showing 1842lt. And I'm using the android companion app to access my instance. Sorry for all this trouble. 😁
from clock-weather-card.
What time zone is configured in your HA instance? e.g. time_zone: Europe/Berlin
from clock-weather-card.
from clock-weather-card.
Just updated after getting back from my holiday, but tested by changing the timezone on my phone. Works as expected which is awesome. Am I right in thinking you achieved this by applying the timezone for HA to the time coming from the browser?
IMHO use_browser_time
should be false by default
as it should correspond to the location that weather is being shown for in the same card!
from clock-weather-card.
Just updated after getting back from my holiday, but tested by changing the timezone on my phone. Works as expected which is awesome. Am I right in thinking you achieved this by applying the timezone for HA to the time coming from the browser?
IMHO
use_browser_time
should be false bydefault
as it should correspond to the location that weather is being shown for in the same card!
yes, agreed. i have this on the radar for the next major version of the card. by default the card would then fetch the current time from HA instead of the browser and a user would be able to disable it by setting use_browser_time: false
.
the reason i didn't do this in the current release is because i did not want to break existing dashboards by changing the default logic of where the card gets the time from
https://github.com/pkissling/clock-weather-card/milestone/3
from clock-weather-card.
thanks for the feedback. i released 1.0.15 today. hope its fixed now. otherwise please open a new issue
from clock-weather-card.
@pkissling it's wonderful after last update! Many many thanks for this! 😎
from clock-weather-card.
Related Issues (20)
- New Time Pattern option doesn't refresh seconds HOT 2
- something wrong in the display of the card HOT 1
- Humidity HOT 4
- "Error when unsubscribing weather forecast: [object Object]" --> high cpu usage on clients (4096 pending messages) HOT 39
- How to implement Ordinal date so 1st, 2nd, 5th, 22nd etc. HOT 1
- New version breaks display of national weather service on desktop. HOT 5
- New version not working with OpenWeatherMap HOT 7
- Can't get days visible HOT 2
- Recurrence of issue from #287 HOT 4
- The forecast_rows block randomly disappears HOT 14
- Updated to new HA update and can’t load my ui now HOT 4
- Invalid DateTime HOT 5
- Allow selection of different weather forecasts to show in rows
- time_format option is ignored HOT 1
- Time in the bar is not aligned with HA time system HOT 2
- Temperature_sensor extra number after the decimal point HOT 1
- Termperature nearby weather image HOT 1
- Get all CSS style elemts HOT 17
- Show also today in forecast part. HOT 1
- Could You add lithuanian language?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clock-weather-card.