rejuvenate / lovelace-horizon-card

Sun Card successor: Visualize the position of the Sun over the horizon.
MIT License
476 stars 35 forks source link

Moon phase integration not recognized after 2024.4 update #122

Closed Nakiros closed 6 months ago

Nakiros commented 7 months ago

Moon integration fail 2024 4 update After 2024.4 update, "(!)" appeared next to moon phase. I reinstalled Moon integration, I reinstalled Horizon card, did HA restart several times, and the "(!)" still won't go away.

Maraptor commented 7 months ago

I have the same problem with moon phases after the update.

MDV85 commented 7 months ago

I have the same problem with moon phases after the update...

изображение_2024-04-05_060315046

iva2019528 commented 7 months ago

I have the same problem with moon phases after the update.

pbranly commented 7 months ago

Hi same issue and Furthemore, it is in English while the moon phase sensor gives the information in my native French language

nepozs commented 7 months ago

The same issue, but problems with Moon are language independent - it is always English only and wrong phase with "(!)" for sure it is HA core 2024.4.x dependent.

Nakiros commented 7 months ago

moon integration Update: the moon phase updated to "new moon" as expected from "waning crescent", so i believe that it connects to the Moon integration, retrevies information from it, but form some unknown reason, it also writes the "(!)"

RaynePhantasm commented 7 months ago

Screenshot 2024-04-08 175039

Additional information: This message appears when you hover over "new_moon (!)": "Install Moon integration to get localized Moon phase name" even though the integration is already installed.

doctorkb commented 7 months ago

connects to the Moon integration

No, it displayed that much before I installed the Moon integration. It's just the translation that needs the integration.

ThomDietrich commented 7 months ago

Hey all, thanks for all the reports. Anyone amongst you brave enough to submit a fixing PR? :)

tigers75 commented 7 months ago

I don't know how to fix it, just to add that it does not work even if forcing the language with the option instead of relying on the card getting the HA language.

Embout commented 7 months ago

There is a typo in the code. Line 2740:

     var moon_phase_localized = i18n.localize("component.sensor.state.moon__phase.".concat(phase.state));

Double underscore in entity name

RogMoe commented 7 months ago

There is a typo in the code. Line 2740:

     var moon_phase_localized = i18n.localize("component.sensor.state.moon__phase.".concat(phase.state));

Double underscore in entity name

...but fixing that does not solve the issue...

rmd-gh commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be

var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state));

Making that change fixed it for me

RogMoe commented 7 months ago

sun3 sun2 sun1

rmd-gh commented 7 months ago

Screenshot 2024-04-15 at 9 07 10 PM

It could be that my "fix" is a fluke that only works for English (not a js guy and no idea how the localisation class works). Do make sure that you don't have a cached lovelace-horizon-card.js in your browser though. I had to clear the cache and reload that file.

rmd-gh commented 7 months ago

I should add that I had to edit the gz file. That seems to be the one that is served

mateuszdrab commented 7 months ago

@rmd-gh that worked for me too - even when I switched language to Polish

By the way, you can remove the gz file when editing, it's simply a compressed version to speed up loading but the script loads just fine without it.

Perhaps PR it?

RogMoe commented 7 months ago

It could be that my "fix" is a fluke that only works for English (not a js guy and no idea how the localisation class works). Do make sure that you don't have a cached lovelace-horizon-card.js in your browser though. I had to clear the cache and reload that file.

Cache cleared and reloaded the page. Not working for me (in Dutch).

JokeRsevilla commented 7 months ago

var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state));

works for me in Spanish, just by reloading the page, modifying .js and removing .gz

JokeRsevilla commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be

var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state));

Making that change fixed it for me

thank you so much!

RogMoe commented 7 months ago

Fixed it too! Thx @rmd-gh !

ThomDietrich commented 7 months ago

Whoever publishes the PR gets mentioned in the release notes! :)

rmd-gh commented 7 months ago

If anyone wants to do a PR, feel free. I don't know enough about building typescript to test, or using github to do that. The actual source location appears to be lovelace-horizon-card/src/utils/HelperFunctions.ts:32

maatx commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be

var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state));

Making that change fixed it for me

Thanks so much, it also worked for the Italian version !

JokeRsevilla commented 7 months ago

@nepozs has already created a pull request

https://github.com/rejuvenate/lovelace-horizon-card/pull/127 👍

jm314159 commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state)); Making that change fixed it for me

Thanks so much, it also worked for the Italian version !

My settings are PL in general apart from language which is EN. The solution is working fine. I only had to convince ;) my browser to refresh the settings effectively. A restart of the core was insufficient. Neither was a common F5 or CTRL+F5. Cleaning the browser cache of past two hours was what only helped.

It is just worth noting I think, in another browser that I did not use to use for HA, just after I logged in, there was no exclamation mark at all.

Bilo2110 commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state)); Making that change fixed it for me

Thanks so much, it also worked for the Italian version !

I've try to do this fix, but for me not working in Italian language

Bilo2110 commented 7 months ago

I took a look at the moon source strings.json and it appears that line 2740 needs to be var moon_phase_localized = i18n.localize("component.moon.entity.sensor.phase.state.".concat(phase.state)); Making that change fixed it for me

Thanks so much, it also worked for the Italian version !

Can you help me @maatx for italian language?

nepozs commented 7 months ago

Can you help me @maatx for italian language?

This issue is language independent, clear cache in browser.

Bilo2110 commented 7 months ago

I've try to crear cache of browser and the app Homeassistant, but not working


From: nepozs @.> Sent: Wednesday, April 17, 2024 10:08:53 PM To: rejuvenate/lovelace-horizon-card @.> Cc: Bilo2110 @.>; Comment @.> Subject: Re: [rejuvenate/lovelace-horizon-card] Moon phase integration not recognized after 2024.4 update (Issue #122)

Can you help me @maatxhttps://github.com/maatx for italian language?

This issue is language independent, clear cache in browser.

— Reply to this email directly, view it on GitHubhttps://github.com/rejuvenate/lovelace-horizon-card/issues/122#issuecomment-2062133158, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6FD6KFCSLX4KJNKKWBQ33Y53JFLAVCNFSM6AAAAABFWS5YFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSGEZTGMJVHA. You are receiving this because you commented.Message ID: @.***>

jm314159 commented 7 months ago

Have you tried in secure/private mode? Or on another computer/laptop/phone?

nepozs commented 7 months ago

Maybe italian translation is incomplete? Does Moon integration work OK?

Bilo2110 commented 7 months ago

Have you tried in secure/private mode? Or on another computer/laptop/phone?

I've try whit private mode in Chrome by smartphone, but same problem

Bilo2110 commented 7 months ago

Maybe italian translation is incomplete? Does Moon integration work OK?

Moon integration work, and give me correct italian translation. Not work in this card. I've tried to add new card... Same problem

jm314159 commented 7 months ago

Perhaps, if not yet attempted, you could try with changing the language for a while with language: en or setting the least config

type: custom:horizon-card
fields:
  moon_phase: true

followed each time by restarting the Core and browser cache/history cleaning (or private mode).

Bilo2110 commented 7 months ago

Wait wait wait... After deleting the .gz file, edit line 2740, cleared cache, finally WORK!!! Thx for all


From: jm314159 @.> Sent: Wednesday, April 17, 2024 10:51:12 PM To: rejuvenate/lovelace-horizon-card @.> Cc: Bilo2110 @.>; Comment @.> Subject: Re: [rejuvenate/lovelace-horizon-card] Moon phase integration not recognized after 2024.4 update (Issue #122)

Perhaps, if not yet attempted, you could try with changing the language for a while with language: en or setting the least config

type: custom:horizon-card fields: moon_phase: true

followed each time by restarting the Core and browser cache/history cleaning (or private mode).

— Reply to this email directly, view it on GitHubhttps://github.com/rejuvenate/lovelace-horizon-card/issues/122#issuecomment-2062282215, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6FD6MGTN3WAJFO4HHGGXDY53OEBAVCNFSM6AAAAABFWS5YFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSGI4DEMRRGU. You are receiving this because you commented.Message ID: @.***>

jm314159 commented 7 months ago

Well, indeed, I forgot that step in my first message. I have also recreated .gz gzip lovelace-horizon-card.js -k

Congrats to you! :)

ThomDietrich commented 7 months ago

Hello everyone, sadly I didn't have the time to merge this one yet (or rather other PRs I want to publish alongside this fix). Will take care of it this evening!

ThomDietrich commented 7 months ago

Hey all, I did merge the PR but sadly our build release pipeline isn't happy with it. Could you @nepozs or someone else please look into this? I am not a js/ts developer.

https://github.com/rejuvenate/lovelace-horizon-card/actions/runs/8807266271

nepozs commented 7 months ago

Nor I am… sorry, looks it needs more changes…

Bilo2110 commented 7 months ago

Hacs give me update from v1.0.0 to v1.0.0.. is possible?


From: nepozs @.> Sent: Wednesday, April 24, 2024 2:46:45 AM To: rejuvenate/lovelace-horizon-card @.> Cc: Bilo2110 @.>; Comment @.> Subject: Re: [rejuvenate/lovelace-horizon-card] Moon phase integration not recognized after 2024.4 update (Issue #122)

Nor I am… sorry, looks it needs more changes…

— Reply to this email directly, view it on GitHubhttps://github.com/rejuvenate/lovelace-horizon-card/issues/122#issuecomment-2073739165, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6FD6JMWDG2MUNCTKSES73Y636HLAVCNFSM6AAAAABFWS5YFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTG4ZTSMJWGU. You are receiving this because you commented.Message ID: @.***>

tormentor22 commented 7 months ago

Wait wait wait... After deleting the .gz file, edit line 2740, cleared cache, finally WORK!!! Thx for all ____ From: jm314159 @.> Sent: Wednesday, April 17, 2024 10:51:12 PM To: rejuvenate/lovelace-horizon-card @.> Cc: Bilo2110 @.>; Comment @.> Subject: Re: [rejuvenate/lovelace-horizon-card] Moon phase integration not recognized after 2024.4 update (Issue #122) Perhaps, if not yet attempted, you could try with changing the language for a while with language: en or setting the least config type: custom:horizon-card fields: moon_phase: true followed each time by restarting the Core and browser cache/history cleaning (or private mode). — Reply to this email directly, view it on GitHub<#122 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6FD6MGTN3WAJFO4HHGGXDY53OEBAVCNFSM6AAAAABFWS5YFOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSGI4DEMRRGU. You are receiving this because you commented.Message ID: @.***>

Same in German. After editing line 2740 and delete *.gz it work now. Thank you guys

ThomDietrich commented 7 months ago

@avataar @edwardtfn are you guys around to have a look at this?

MelleD commented 7 months ago

For me the fix do not work.

I need this as entity: component.moon.entity.sensor.phase.state. Then everything is working. The fix without "moon" is not working. I saw also some test issue with the persia language tests. I ignore them for the first time. Maybe someone who speak the lang should add tests for that :-).

I had some trouble with the build pipeline. My changes were not taken into the release.

https://github.com/rejuvenate/lovelace-horizon-card/pull/131

Bildschirmfoto 2024-04-27 um 00 51 54
s-hutter commented 6 months ago

Quick fix using Card Mod without modifying files (English only):

type: custom:horizon-card
time_format: 24
fields:
  moonrise: true
  moon_phase: true
  moonset: true
card_mod:
  style: |
    .horizon-card-field-value-moon-phase span {display: none;}
    .horizon-card-field-value-moon-phase:before {content: "{{states('sensor.moon_phase')|replace('_',' ')|title}}";}
DJaeger commented 6 months ago

Quick fix with modifying file (incl. localized) from terminal/ssh:

cd config/www/community/lovelace-horizon-card/
sed -i 's/component.sensor.state.moon__phase./component.moon.entity.sensor.phase.state./g' lovelace-horizon-card.js
rm -f lovelace-horizon-card.js.gz &&  gzip lovelace-horizon-card.js -k
ha core restart

Clear your browser cache and reload afterwards!

MelleD commented 6 months ago

I already fixed it, PR is still open.

Meanwhile you could try it with my repo. It's released here: https://github.com/MelleD/lovelace-horizon-card

dunxd commented 6 months ago

Looking forward to the PR that fixes this being merged.

ThomDietrich commented 6 months ago

Dear all, this bug is now fixed in the most recent release https://github.com/rejuvenate/lovelace-horizon-card/releases/tag/v1.1.0 - there are a lot more changes in that release.

This repository is hosted under the rejuvenate organization. We are always open to new contributions and happy for anyone participating in discussions and the review process! If you are a passionate js/ts developer and would like to be more involved with this project please also check the open feature suggestions ;)

Cheers!