CR or LF on a control page question

Posted on
Sun Aug 13, 2017 11:06 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

CR or LF on a control page question

Hi, I have a control page that lists the current forecast for my area - the problem is, the message text is sometimes short (a word or two) and sometimes it might be 10 words. Is there a way to have the message wrap so I can display it in a given size, say two or three lines vice one very very long horizontal line?

Thanks for any help...

_______
Norm

Posted on
Mon Aug 14, 2017 3:56 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: CR or LF on a control page question

The Matplotlib plugin has a multi line text device type that might work for you, and I also have one or two example scripts to display multi line text in my plugin forum.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 14, 2017 5:41 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: CR or LF on a control page question

Thanks Dave - I try messing with those today :D

_______
Norm

Posted on
Mon Aug 14, 2017 5:45 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: CR or LF on a control page question

Let me know if you have any questions. The script thread may be a little tough to find, so here's a link:
http://forums.indigodomo.com/viewtopic.php?f=149&t=13908&hilit=multiline+text

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 14, 2017 10:58 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: CR or LF on a control page question

Well, that turned out to be too hard for my small brain, but that is OK - On the up side, it did get me looking at your fantastic WUnderground plug-in.

Wow, thanks so much for providing it. I do have a question on it - I was wondering if it is possible to pull down a completed image like the one below - vice trying to build it from scratch from the WUnderground components. Thanks again....
Attachments
2017-08-14_09-56-51.png
2017-08-14_09-56-51.png (88.09 KiB) Viewed 3963 times

_______
Norm

Posted on
Mon Aug 14, 2017 11:13 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: CR or LF on a control page question

That really comes down to whether hot linking is blocked on the site you're trying to get the image from, and whether it's dynamically generated.

If you can right click and choose to load the image from the original website in a new tab of it's own, you can just place the resulting URL in your control page. If it's dynamically generated and you can figure out the format of the dynamic generation, then you could use various programmatic substitutions and the Dynamic Refreshing URL plugin to display it.

(I just looked at that image live on wunderground.com, and it is NOT a graphic in the URL sense.)

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Mon Aug 14, 2017 11:24 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: CR or LF on a control page question

The WUnderground plugin has a satellite image downloader device that could work for this purpose, but there are many ways to skin this particular cat. If you can get an underlying URL for the image, you may just be able to use Indigo's native control page tool for refreshing URLs.

The plugin doesn't have any built-in capability to construct images like the one you're after.

Hope you enjoy the plugin.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 14, 2017 11:32 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: CR or LF on a control page question

I know - I wish it was a URL - I'll look at the satellite image downloader - thanks again for the plug-in....

_______
Norm

Posted on
Mon Aug 14, 2017 11:50 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: CR or LF on a control page question

If it's not a URL, then the satellite image downloader isn't going to help I'm afraid.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 14, 2017 11:54 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: CR or LF on a control page question

Yes - I just looked at it -- not a PNG either - Looks like this too hard also :-(

_______
Norm

Posted on
Mon Aug 14, 2017 12:43 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: CR or LF on a control page question

It's not that hard. I use web2png to convert a section of a webpage from dark sky.net to a png and store that for my control pages. Install webkit2png using brew.

Since the resultant page will likely have more info on it than I want, I embed the page in an iframe and chop down the iframe to the dimensions I want.

Code: Select all
<!DOCTYPE html>
<html>
<head>
    <style>
        #timeline {
   width: 800px;
   height: 210px;
   background-color:transparent;
   border: 0px none;
   margin-top: -50px;
   margin-left: -24px;
}
    </style>
    <script src="/scripts/snippet-javascript-console.min.js?v=1"></script>
    </head>
<body>
    <iframe id="timeline" src="https://forecast.io/embed/#lat=33.38&lon=-86.70" scrolling="no" frameborder="0" ></iframe>
    <script type="text/javascript">
       
    </script>
</body>
</html>
modify the code above to suit your needs and save it as something like "forcast.html", then run webkit with some switches to manipulate the resultant image further:
Code: Select all
webkit2png -C --clipwidth=800 --clipheight=180 --scale=1 file:///Users/terry/Desktop/forecast.html --transparent --delay=2 -o forecast
Note: Help is available by running webkit2png -h and the --delay=2 lets the webpage render for 2 seconds before converting to a png.

The above produces the following image:
forecast-clipped.png
forecast-clipped.png (36.78 KiB) Viewed 3928 times


Terry

Posted on
Mon Aug 14, 2017 1:12 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: CR or LF on a control page question

This should get you really close. You'll need to substitute your location; I got the link below by clicking on "Full Forecast" from the main WU website, then clicking on the "Forecast" tab on the next page. Modify and save the following code somewhere (I used the filename "wufc.html" in this example):

Code: Select all
<!DOCTYPE html>
<html>
<head>
    <style>
        #timeline {
   width: 800px;
   height: 1351px;
   background-color:transparent;
   border: 0px none;
   margin-top: -970px;
   margin-left: -10px;
}
    </style>
    <script src="/scripts/snippet-javascript-console.min.js?v=1"></script>
    </head>
<body>
    <iframe id="timeline" src="https://www.wunderground.com/us/al/birmingham/zmw:35201.1.99999#div.plots.has-header" scrolling="no" frameborder="0" ></iframe>
    <script type="text/javascript">
       
    </script>
</body>
</html>


Then run webkit2png against it like so:
Code: Select all
webkit2png -C --clipwidth=800 --clipheight=400 --scale=1 file:///Users/terry/Desktop/wufc.html --transparent --delay=5 -o wu10day
to produce the following image:
wu10day-clipped.png
wu10day-clipped.png (104.88 KiB) Viewed 3913 times


I had to use a 5 second delay to allow WU to build the forecast. Also note that this will work until they change something on their site. How this gives you a good starting point.

Terry

Posted on
Mon Aug 14, 2017 3:47 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: CR or LF on a control page question

Thanks Terry but...

Trying - webkit2png http://www.google.com/

got me...

2017-08-14 14:41:06.181 Python[95420:7212295] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
... something went wrong: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

Easy for you is more than likely impossible for me :cry:

No worries - I already gave up - I don't what to mess up my Indigo PC - but thanks for trying to help me...

_______
Norm

Posted on
Mon Aug 14, 2017 4:00 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: CR or LF on a control page question

I have been using a combination of Indigo Control Pages and the Matplotlib Plugin to do this:

Screen Shot 2017-08-14 at 4.57.49 PM.png
Screen Shot 2017-08-14 at 4.57.49 PM.png (103.6 KiB) Viewed 3873 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Aug 14, 2017 4:45 pm
roussell offline
User avatar
Posts: 1108
Joined: Aug 18, 2008
Location: Alabama

Re: CR or LF on a control page question

norcoscia wrote:
Thanks Terry but...

Trying - webkit2png http://www.google.com/

got me...

2017-08-14 14:41:06.181 Python[95420:7212295] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
... something went wrong: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

Easy for you is more than likely impossible for me :cry:

No worries - I already gave up - I don't what to mess up my Indigo PC - but thanks for trying to help me...


Don't give up, you're so close to a new addiction!! :twisted: The answer is in the error - use https://www.google.com for your test. (notice the "s" after http, that's a secure http request) so:
Code: Select all
webkit2png https://www.google.com/
will get you:
wwwgooglecom-full.png
wwwgooglecom-full.png (51.88 KiB) Viewed 3831 times



Terry

Who is online

Users browsing this forum: No registered users and 4 guests