I've been struggling with this all day. I'd like to create a hyperlink from userReadings.. take an IP from a reading and inject it into a URL that is then clickable from FHEM... not joy.. can't even add a simple string...
I've done it previously with a value format for a readingsGroup like this
attr MQTT_IPs valueFormat <a href='http://$VALUE' target="_blank">$VALUE</a>
but I'd like it to appear now, in the readings list for the actual device...
I've tried
userReadings
{ ( "http://") . (ReadingsVal("mqtt_pc_power","IP",0));; }
and many other variations but i can't get it to append the readings to text... any help appreciated, as usual.
thanks
<html><a href=blabla>Link</a></html>
I tried that. Nothing happens when it is updated.
I need to be able to insert the ReadsVal into a string containing that text.
Can you show me a list of device
Ok, so i was doing something wrong. And i've made progress... but it is not working. I can inject the IP into the HTML but it is not marking it up in FHEM.. see pictures
And the attr userReading Code?
attr mqtt_pc_power userReadings URL { "<html><a href='http://".( ReadingsVal("mqtt_pc_power","IP",0))."' target='_blank'>Link</a></html>";; }
I'm afraid there is extra code (FW_htmlEscape) in 01_FHEMWEB.pm wich is converting html into text.
The <html>bla</html> trick is only used for return values of a command (e.g. get or set), which avoids converting.
I have no problems in activating the trick for this purpose (i.e. displaying readings or attributes) too, but I'd like to hear some comments on it from other developers.
That would be ace :)
Hallo Rudi,
Danke Dir für Deine Antwort. Die Befürchtung mit dem only Works by return hatte ich schon fast, konnte nur nicht testen.
Grüße
I've added an exception for Readings only.
Attributes and Internals are not (yet) handled.
Summary:
if the value of a reading is enclosed in <html>...</html>, then the ... is not escaped, and is sent to the Browser as HTML.
I've done an update but this does not seem to changed things. Does it take a while or does a release have to be made to get the changes. Thank you very much for adding this feature.
Andrew
every morning at about 8'o clock the changes from the prior day are available with the update command.
That works! I'm happy. thanks everyone!