domoticz / Reacticz

Reacticz dashboard
Apache License 2.0
34 stars 15 forks source link

TextWidget new secret feature (Request) #3

Open t0mg opened 7 years ago

t0mg commented 7 years ago

From @NietGiftig on January 31, 2017 14:18

Following up a discussion in the WindWidget pull request https://github.com/t0mg/reacticz/pull/45 about showing data in reacticz

if it is only about showing bits of information in Reacticz, there is a "in between" solution. Make in the txt widget a routine that can divide the text into parts. Lets say, if the txt begins with the magic word 'qyz' Take the first part of the txt until a divider for example '~' and show it on row 1 Do the same for the next 2 lines of text so you can have 2 or 3 lines of Text in your own "Style". The normal user never sees it or has to use it, but the well informed ones can use it for their own benefits. They only have to fill a txt device in domoticz (Lua etc) with the data divided in rows they want to show in Reacticz No further settings in Reacticz required.>

t0mg added to these remarks the sentence:

We could also provide a syntax to select an icon so that you can look like an alert, contact, watt, wind, etc widget. <

witch would be a tremendous advantage to some people ;-)

Copied from original issue: t0mg/reacticz#47

t0mg commented 7 years ago

This is a nice idea for "advanced users". I think we need to agree on the requirements and exact syntax before writing some code.

I don't have a lot of bandwidth so it'd be great if we found volunteers to make this change and/or write some documentation in the wiki as well (syntax, supported icons).

Note: please assign yourself on the issue if you want to contribute so that we don't work in parallel :)

t0mg commented 7 years ago

From @NietGiftig on January 31, 2017 15:8

I have no idea how to assign myself. As I'm not useful for .js coding, rather not in the coding part, it would make it more difficult for others. I not a Icon man, but use Icons in the Reacticz style, if nessecary I wil go on Icon hunt ;-) In the wiki I can do some documentation bits, as soon as I know what direction to go. Basic requirements in my view:

t0mg commented 7 years ago

I disagree on the bold styling :) Styling should not be handled in multiple uncorrelated places. For the rest it's fine by me (btw, by default there is no icon in TextWidget, so no need for an option to hide it).

I still don't have time to implement this but here's a proof of concept for passing special options in the text value: https://jsfiddle.net/gh9tnva5/

This function turns a string like "[rctz]option1=value1,option2=value2[/rctz]" into a JS object {option1: "value1", option2: "value2"} or returns null if no secret option was found.

In Reacticz TextWidget, we could parse the string either from the device name or from the text value and once we have the object it would be easy to apply the options to set an icon or customize the text content. We just need to define the options :) hideName and icon are the only two I can think of right now.

Re. icon scaling, that's a fair point but I don't think it should be customizable, we should simply fix it globally by setting a max size on icons in GenericWidget.

davidlb commented 6 years ago

Domoticz now supports multiple lines for Text and Alert devices (domoticz/domoticz#1942)

NietGiftig commented 6 years ago

Nice! I'm still using Reacticz with same old version of Domotizc Still very, very pleased with it, for me proof that it is not always necessary to change things. I'm reluctant to update Domoticz, there are so many changes not sure if it will not break my current use. I will have another look on updating when I have more time at hand.

t0mg commented 6 years ago

Thanks for the heads up @davidlb - So at some point Reacticz should also be updated to support \n and \r and render them as
. Probably in GenericWidget.js.