HABPanel in german using Map Transformation

Hallo Andy,
ich glaube wir können in ner PM auf deutsch ausweichen :slight_smile:
Hmm wenn ich also richtig verstehe, dann klappt die Übersetzung im HAPPanel bei Dir auch nicht.
Im offiziellen Wiki wird auch nur ein Beispiel für einen Fenstersensor gezeit, wie ich mittlerweile gefunden habe.
In der KNX sektion habe ich ein Beispiel für ein Switch mapping gefunden, aber das hat nicht funktioniert. Ich hab mir beim testen sogar den openhab service abgeschissen :(. Im GIT repository habe ich keinen passenden Bugeintrag gefunden. Oder hast Du mal was gefunden welche Widgets übersetzbar via map sein sollen?

Gruß
Andreas

Hallo Andreas,
deutsch gefällt mir besser… Hoffe mein Englisch war nicht zu schlecht :joy:
Ist dann aber leider nicht für alle ersichtlich.

Im HABPanel habe ich es auch noch nicht geschafft das Mapping anzuwenden.
Wenn ich es in deutsch haben will, habe ich mir bisher ein eigenes Widget gemacht, z.B. mein Wetter Forecast.

Einen Switch kann man auch selber schreiben, aber hatte ich bis jetzt noch nicht im Fokus.

Im BasicUI funktioniert das mapping einwandfrei, gefällt mir aber nicht aufm Tablet.

Habe noch kein übersetzbares Widget gefunden.

Wenn ich es überhaupt hier schreiben darf, bin ich eh noch hin und her gerissen zwischen Node-Red und OpenHAB :confounded:

Sorry guys, if you want to use German, switch to PM, otherwise use English as this is an international forum.

sorry hans-jörg. we will do so.

Ok, i give up.
I tried to use the official doc stuff:
http://docs.openhab.org/configuration/items.html#transforming


http://docs.openhab.org/configuration/sitemaps.html#element-type-text

But i don’t get it :frowning:

So first a basic question: Is HAPPanel supporting all these MAP and Transforming stuff or is only the BasicUI supporting it?

If HAPPanel supports it 100%, i got the Window Rotary Handle Status translated, but nothing else.

So this leads to my second basic question: Is a MAPping and Transformation working based on widgets, means a transformation “translates” a dummy widget, no matter what it shows

OR is the trasnformation “looking” into for example a dummy widget and sees if this is a status of a “switch” or a device status, for example if the battery of one of my actors reached it’s life.

Would be very nice if we can get here a few options and opinions and then get a good tutorial done to cover this translation section fully.

Thanks for any help
Andreas

For now displaying the transformed value in HABPanel is not supported, but I’ll try to come up with a workaround.

As a workaround I added another String Item and update it by a rule.
See my Weather example:

rule "Condition Changed"
when
	Item Weather_Condition2 changed
then
	Weather_Condition_Text.postUpdate(transform("MAP", "weather_de.map", Weather_Formatted_Condition2.state.toString()));
end

Perhaps not the best way to do it but it works for now.

Hi, transformed states will be considered by default from now on (next snapshot).
See:

Cheers

1 Like

Hi Yannick,

am I right, that the transform should be working in the recently released OH 2.1?
I have some transformations like
String BerlingState "Status [MAP(neato.map):%s]"
But I still get the unnmapped state.

My widget looks like this:
Do I need to adjust something I might have missed?

<button class="btn" style="width: 100%; height: 100%; padding: 0; background: inherit; outline: none">
<span>
<widget-icon iconset="'freepik-household'" icon="'vacuum-cleaner'" size="32" state="itemValue('Online_St')" />
</span>
<span style="color: #4CC417; font-size: 10pt; text-align:center">{{itemValue('BerlingState')}}<small style="font-size:8pt"></small></span>
</button>

The itemState (formerly itemValue) function in templates also now returns the transformed state by default, unless you set the new second parameter to true i.e. itemState(‘Item_With_Map’, true). Use the raw state in conditions like ng-if without the transformation if possible.

1 Like

@NCO open a browser to http://youropenhab:8080/rest/items/BerlingState

It should show a transformedState with your mapped value, and this will be used by HABPanel by default (as indicated by @sihui’s post above). If you don’t see a transformedState check your items config.

Thanks @ysc & @sihui
I will check it out

Hmmm. The transformedState is there but not shown in habpanel , if I use itemState instead of itemValue (which is shown correctly with its raw state.

{"link":"http://192.168.178.50:8080/rest/items/BerlingState","state":"IDLE","transformedState":"Bereit","stateDescription":{"pattern":"","readOnly":false,"options":[]},"type":"String","name":"BerlingState","label":"Status","tags":[],"groupNames":["G_jdbc"]}

If I replace the itemValue with itemState, the state just disappears in the template tile.
With itemValue it is showing the correct original state.

I don’t get the point.

itemState and itemValue are really supposed to be the same…
Morever, there’s a second parameter to ignore the transformation which is disabled by default.
itemState('BerlingState', false) or itemState('BerlingState') should apply the transformation and itemState('BerlingState', true) return the raw value without applying the transformation.

Which browser/bundle version are you using?

Thanks @ysc
That’s really strange. Your definition above I understood (I guess).
So true as the second argument would return the raw state (not transformed)

Is there anything else which might be wrong in my syntax above?
I am using Habpanel on my iPhone with safari (iOS 10.3.2) and the Habpanel bundle which comes with the OH 2.1 release.

I guess I would blame iOS Safari since there have been several problems with it already.
Can you try the same dashboard in Chrome or Firefox on a computer to definitely blame the browser? It would help pinpointing a potential problem.

Thanks, I did not even think about this option, because I never had problems with Habpanel and safari so far.
I tried it on my computer (Firefox) and it worked right away as you suggested.
Thanks
Now I am going to find a better full screen browser for my phone! :wink:
Again, thanks a lot!

I tried another thing.

Usually I use Habpanel by safari as a link on my homescreen (I assume safari works in the background)

However, this link (as mentioned above) has problems displaying the itemState correctly, but shows my custom icons perfectly (copied into smartphone-set folder in assets and changed the smartphone-set file accordingly)

Running HABpanel directy in safari shows the itemState correctly but not the icons.

Do you have any idea why safari is not able to localize the icons?

Never mind - I figured it out

I checked some posts and found out that I have done this (pretty long ago):
Clone all from the habpanel web folder from github into html/habpanel (you’ll have app, assets, fonts etc. then in the html/habpanel directory)

You won’t see the new icons until you use the static-URL: http://your-openhab-server:8080/static/habpanel/index.html

I did not remember, that my (old) habpanel placed on my homescreen hadhardcoded the static html liked.
That’s why it did not show the right itemState because I was actually running the old habpanel, not the one coming with OH 2.1.

After cloning the web folder from habpanel into my /etc/openhab2/html/habpanel including the icons I have added to my previous (old) habpanel, everything works as expected.

Thank you!

1 Like