AppDaemon / appdaemon

:page_facing_up: Python Apps for Home Automation
Other
833 stars 418 forks source link

Gauge widget - cannot display decimals and units #454

Open rds76 opened 5 years ago

rds76 commented 5 years ago

Gauge shows just rounded number even I specify precision. I also have to specify units otherwise it shows "undefined", HA has correct unit of measurement set. Btw, basic sensor widget shows it correctly . Finally units: "°C" displays: \°C expecting: °C

ReneTode commented 5 years ago

there is no precision setting for gauge, so its obvious that setting it wont work. its designed for rounded numbers, but precision can be added when we start working on dashboard again.

allthough the docs say that HA units are used i dont see that in the code, so i guess thats missed somehow.

IanK6449 commented 10 months ago

Hi guys,

It's been a while but has anybody made any progress with this one? I'd have a crack myself but have no idea how to access the source code for the base widgets. If you can give me any steer in that regard I'll take a look at it.

Cheers, IK

acockburn commented 10 months ago

There is a section in the docs on widget creation here:

https://appdaemon.readthedocs.io/en/latest/WIDGETDEV.html

IanK6449 commented 10 months ago

Yeah I have looked at that and I thought I could create an extended version of the gauge widget from the base version. I think this is pretty do-able but I am then a bit stuck as to how to modify the code to add a precision parameter. I was hoping to look at the code for the sensor base widget to get some ideas… but there doesn’t seem to be a base sensor widget. Consequently I am a bit stuck as to how to proceed but will see if I can do some research on how to do it. As you’ll probably guess, my JS, CSS and HTML skills are all pretty elementary so fingers crossed.

Thanks for your pointer anyway though.

Cheers,

IK

From: Andrew Cockburn @.> Sent: Friday, November 24, 2023 12:47 AM To: AppDaemon/appdaemon @.> Cc: IanK6449 @.>; Comment @.> Subject: Re: [AppDaemon/appdaemon] Gauge widget - cannot display decimals and units (#454)

There is a section in the docs on widget creation here:

https://appdaemon.readthedocs.io/en/latest/WIDGETDEV.html

— Reply to this email directly, view it on GitHubhttps://github.com/AppDaemon/appdaemon/issues/454#issuecomment-1824556859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJHUZDQDJSZCN54PSWVIYWDYF5OXZAVCNFSM4GLPGQVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGQ2TKNRYGU4Q. You are receiving this because you commented.Message ID: @.**@.>>

acockburn commented 10 months ago

The sensor widget is derived from the basedisplay widget - the idea being that various types of derived widgets with variations can link back to the same base code to enable some re-use.

IanK6449 commented 10 months ago

OK, thanks Andrew, that helps. I have taken a look at the code for the gauge widget and it appears to call a function called JustGage. But I can't find anything on that function itself. Is that some compiled code somewhere in the guts of HADashboard that I won't be able to look at? Apologies for all the questions!

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Andrew Cockburn @.> Sent: Saturday, November 25, 2023 1:43:27 AM To: AppDaemon/appdaemon @.> Cc: IanK6449 @.>; Comment @.> Subject: Re: [AppDaemon/appdaemon] Gauge widget - cannot display decimals and units (#454)

The sensor widget is derived from the basedisplay widget - the idea being that various types of derived widgets with variations can link back to the same base code to enable some re-use.

— Reply to this email directly, view it on GitHubhttps://github.com/AppDaemon/appdaemon/issues/454#issuecomment-1825839335, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJHUZDWDDCCLTE7WMLWYARDYGC6B7AVCNFSM4GLPGQVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGU4DGOJTGM2Q. You are receiving this because you commented.Message ID: @.***>

acockburn commented 10 months ago

It’s a 3rd party library included to actually render the gauge graphics.

IanK6449 commented 10 months ago

OK, thanks Andrew. Fingers crossed I can get a decimal place working 😄

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Andrew Cockburn @.> Sent: Saturday, November 25, 2023 11:43:43 PM To: AppDaemon/appdaemon @.> Cc: IanK6449 @.>; Comment @.> Subject: Re: [AppDaemon/appdaemon] Gauge widget - cannot display decimals and units (#454)

It’s a 3rd party library included to actually render the gauge graphics.

— Reply to this email directly, view it on GitHubhttps://github.com/AppDaemon/appdaemon/issues/454#issuecomment-1826321712, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJHUZDVNUMBEBN3RPZQVWX3YGHYY7AVCNFSM4GLPGQVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGYZTEMJXGEZA. You are receiving this because you commented.Message ID: @.***>

IanK6449 commented 9 months ago

Hi Andrew,

Thank you for you assistance / support.

So, I finally managed to get the decimal place working in the gauge by changing the function call to JustGage in the basegauge js file. I eventually thought to look that function up and discovered the huge list of parameters it can take. Adding humanReadable true to the function’s parameters seems to have done the trick. I am not 100% sure this is how that parameter is supposed to work but it does seem to have done what I want so I’m calling that a win 😊 I may try to make that call dependent upon whether precision is specified in the dashboard yaml file next… who knows, it may even work.

From: Andrew Cockburn @.> Sent: Saturday, November 25, 2023 1:43 AM To: AppDaemon/appdaemon @.> Cc: IanK6449 @.>; Comment @.> Subject: Re: [AppDaemon/appdaemon] Gauge widget - cannot display decimals and units (#454)

The sensor widget is derived from the basedisplay widget - the idea being that various types of derived widgets with variations can link back to the same base code to enable some re-use.

— Reply to this email directly, view it on GitHubhttps://github.com/AppDaemon/appdaemon/issues/454#issuecomment-1825839335, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJHUZDWDDCCLTE7WMLWYARDYGC6B7AVCNFSM4GLPGQVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGU4DGOJTGM2Q. You are receiving this because you commented.Message ID: @.**@.>>

acockburn commented 9 months ago

Good luck – good progress so far 😊