Hi,
This may be a stupid question, but I am trying to read a value from my feeds to insert into a textbox on my dashboard.
The available feedvalue widget makes the text blurry and very restrictive editing is possible.
I have tried:
<iframe src=https://emoncms.org/feed/value.json?id=370069 </iframe> But with this I can only get the value in “” and cannot edit the text format.
Also looking at reading out of the JSON but have no idea how…
I’m not sure.
Maybe use an online editor and firefox ‘inspect’ to help debug? Online HTML Editor - 𝗛𝗧𝗠𝗟-𝗢𝗻𝗹𝗶𝗻𝗲.𝗰𝗼𝗺
I’m also interested in the result as I’m building a dashboard today. I’ll have a look.
When you post any code, could you please put 3 back ticks ` before and after the code, so that it displays correctly.
I’ve just edited your post above, and added them.
You can edit the feedvalue widget font, font style, font weight, size, colour, what else do you need?
Reading JSON requires javascript, what are you looking to do?
I raised an issue on emoncms (#977) about some formatting of a api reply, while looking into that I learned about the php json.encode() defaults and suggested those defaults get over-ruled and the “emoncms defaults” get set in a wrapper function for encoding JSON.
The numerical values being returned as strings has come up before as you know (#273 and #540), I’m guessing that maybe using proper float JSON settings that might also handle nulls, infs and nans without manually handling the stings as has been the case in the past, but that is just a guess
As it happens I was using feedvalue widgets the other day and found it frustrating that I could not set both a pre-fix and post-fix (unit) eg
Temp1 <val> °C
I had to chose between putting the single “unit” field before or after the value. That selection (before or after) uses a field itself. IMO it would be better to have a leading text and trailing text, still only 2 fields but vastly more flexible.
I currently have to use
<val> °C (Temp1)
which I really don’t like. I could have a seperate second text box, but I find myself dragging these around alot and having to try and keep the textbox and feedvalue grouped and aligned is a pain.
Annnnd… (since you ask)
It would be real nice if the widget settings could be carried forward when creating a batch of new feedvalues. I recently set up 40 feed values on one page all the same, but the font, weight and size all had to be changed individually, it would be nice if I could have set up one and then the next “new feed value” had the settings applied from the last. it only needs to last the edit session, I think it would get a bit messy for users to be able to save their own widget settings. Could this be possible by changing the scope of the widget variables?
The other problem with the widget is that the resolution is a bit fuzzy and you can’t align text right or left. I also was after the above pre and post text fields so that solves part of the problem. Alignment options would be great though
Yes, that was something else I found frustrating too. I was (on this occasion) trying to show a floor plan with temperatures all around the edges and wanted to put those temps inside the rooms but as close to the walls as possible without clashing. The top and bottom walls are fine, but ideally I would have liked the left hand wall temps left aligned and the right hand wall temps right aligned so that any movement in the decimal scaling would not alter the distance between the feed value and it’s corresponding wall.
I’ll raise some issues for feature requests.
Here is a partial screenshot (browser scaling at +500%) which seems to show your right about the fuzzy resolution. In that shot the feedvalue is using Arial,Bold,16px, Black with an “after” unit of “°C t05” and auto decimals.
I’m also pretty sure when I added that feedvalue it was fully inside the grey block, it was showing around 17°C at the time so I’m surprised it is now overflowing the box area. So the positioning logic is pretty “fuzzy” too.
What this snippet is doing is to retrieve the minute value of the time I’m logging and comparing it to the local minute. If it’s out by more than 2 minutes then I turn my time display red to show that something’s not updating.
So this just displays the local time on my dashboard, updated every 5 seconds, normally black but turn red if my feeds aren’t updating for some reason.
I’ve changed the feedvalue widget to use standard html text rather than canvas for rendering (available for testing in latest master branch of the dashboard module), this fixes the fuzzy text issue.
Also added in feedvalue left, center, right align option.
For the prepend/append units option I realise removing the option field for units and unit positioning and replacing with two new options “prepend” and “append” will affect existing dashboards. Any preferences on how to proceed?
If there are going to be big changes to many a dashboard we could look at doing dashboards v2 perhaps, to somehow manage versions to allow .org users time to adjust.
For the emoncms local, could just go for it I think. If people press the update button and stuff is different it’s ultimately their responsibility, and it really is too valuable a minor update to not do. I say go for it