Computer Related > Raspberry Pi Miscellaneous
Thread Author: smokie Replies: 19

 Raspberry Pi - smokie
I think there are a few here who have stuff going on on a Raspberry Pi, or be interested in what can be done, so let's try a new thread to cover this stuff all in one place and share experiences.

Please remember to begin a new discussion on a different module as a reply directly to this first post, but replies on existing discussion should be added to the post you are responding to (so threaded view works OK

I realise this is a bit niche for a car site but attendance and/or comment on this thread isn't obligatory :-) and I thought it might flush out another nerd or two :-)
Last edited by: smokie on Sun 21 Mar 21 at 14:22
 PiHole - smokie
PiHole is a free app for the Raspberry Pi which allegedly removes all ads. pi-hole.net/

It works by becoming your DNS server, which can be configured in (at least) two ways, either configuring the IP address of the PiHole Pi as your DNS server in your router, or in each device.

If you want to set it up at network level (rather than device level) and your router doesn't allow you to reconfigure the DNS server then if you disable DHCP on your router and enable it within the PiHole software.

 PiHole - smokie
My experience with PiHole is that it doesn't block the ads I'd like it to, and/or some sites become inaccessible. I suppose this is inevitable - given the site owners want you to see their ads they will do all they can to prevent you blocking them. The specific issues I've' had so far:

I needed to whitelist a few sites which Google uses when you do a search (say for LG TV), go to Shopping, and select an item. You don't see these when browsing normally and I suspect they are analytics or tracking sites.

I don't think it blocks many (if any) ads at the start of YouTube videos and similar

I couldn't get into My5.tv (Channel 5 TV services) at all

I have a couple of games on my phone - Candy Crush stil shows ads but Rummikub seems not to. I'm talking about the external video ads not the ones promoting in-game purchase etc, which I wouldn't expect it to block.

I suspect it does a reasonable job of removing webpage ads - I put it onto SWMBOs laptop and she said Mailonline was usable again. (Oh dear)

So for me it hasn't really done what I wanted - removing the video ads from video sources - unless I'm missing something.
 PiHole - Crankcase
Ok, as you know I'm interested in this one, smokie, so some long winded stuff here:

For me Pihole seems to work pretty well at suppressing unwanted stuff across all my devices.

The fefailt blocking (Gravity) list gets rid of a gazillion tons of stuff, but of course there are other multiple other lists available to add if you want. Google them up, paste the list url into the admin page in Pihole, done.

What I do is some tweaks. This is really just a case of using the query log the first time you go to a site.

Launch the query log in the Pihole admin web page for the device you are looking at (by clicking its name/ip in the dashboard)
Go the site of interest in a browser on that device.
Refresh the query log

Now you have a list of what the device is trying to do. Some sites will be whitelisted, some blacklisted, because they were on the Gravity list. Fiddle with them.

I usually start by blacklisting the lot other than the main site, then whitelist stuff a bit at a time until it works, but doesn't show ads. After a while you get to suss which are obvious trackers and ad servers.

It seems like a faff, and sometimes (like for all4) someone has done the work for you, so a google for the site name and "pihole" often yields exact things to block or not.

It seems like a faff of course, and it is a bit, but once it's done you don't have to do it again unless the web site changes drastically, and also you find that similar sites use similar tech. So I tweaked the bejeesums out of the Cambridge local news site to get rid of stuff, but now almost every local news site I look at is also sorted without me doing anything further.

As to My5, this was a mystery as I have it ad free, until I tried to replicate what you say. Turns out you're right - on a PC. I nerver watch on a PC so hadn't seen that behaviour. Site/player won't load, unless you allow the adobe asset tracker, it all works, but then the ads appear...

However, on my Fire Stick, My5 (and ITV Player and All4) all work with no ads at all, without any tweaking. I don't know why, so I'll leave that one.

I'm not sure whether Pihole 5 (I'm on 4) allows you to blacklist things on some sites and not others - so the adobe asset tracker might be allowed on My5 but nowhere else, or on one device and not another for example. I'll have to look into that one.

Lastly, it will never work on sites where they stream ads from the same domain as the main site (as Youtube does), so that's that. Use other solutions or live with it.

And my final bit of blether - I use it to stop trackers. So for example, as I don't use Facebook or have an account, all Facebook related stuff (just search the query log) I block. Loads and loads of sites try to talk to Facebook and send info - no more for me. Repeat as you want.

I have some games - in the background they want to send stuff back to the provider. I block them, my network is less loaded, they don't get to spy and the games still work. Makes me happier.

Microsoft - well, you can imagine, but loads can be blocked with Pihole at no detriment.

Google Analytics - none of that thank you.

etc etc. Depends how much you enjoy fiddling I guess.

I'm running at approximately 25% of all network traffic being blocked by Pihole (top of the admin page) and it all seems good to me.
 PiHole - smokie
OK, thanks, clearly I need to "rtfm"!!! So often this is a problem for me, I do these things on a bit of a whim, get it working then don't exploit it properly or at all because I move onto the next thing too quickly.

WRT to PiHole I don't need to worry about the volume of traffic particularly, in fact I'm not too bothered by the occasional ad, but I'm less keen on the tracking and some of the less obvious stuff going on, and to be able to prevent that at the network (rather than per-machine) level could be interesting.
 PiHole - Crankcase
I think I was originally interested in blocking trackers too. I installed Wireshark, spent some time appalled at what my PC was talking to, thought, aha, now I know what it's doing, how can I stop that, and I found Pihole.

If you haven't explored Wireshark, well off you go...
 PiHole - smokie
I used Wireshark a year or so back when my WAN IP kept getting blacklisted by some organisation for spamming, which passed the details to my ISP who then wouldn't allow me to send outbound mail. I correctly assumed one of the many machines on this network had a virus and used Wireshark to identify which one it was - which I successfully did! I'll have look at this sometime, I seem to have too much to do these days!!
 PiHole - smokie
I'm just having a further look at PiHole and I found a Windows program called DNS Swapper github.com/tryallthethings/DNS-Swapper which puts an icon in your taskbar which allows you to temporarily revert back to your usual DNS settings. This would seem to be a good thing, as it will let me easily bypass it if there is a page I need to reach. (I realise that means I might be allowing some baddies through to my machine but it would still mean a lot are being kept out.)

I've also added a few blocklists and done something with my Gravity.

Thanks for the tips.
 PiHole - Crankcase
Good stuff smokie.

Now, if you discover, as I did recently, that somehow ads start popping up even though PiHole swears blind nothing is getting through, you too can discover the delights of your browser deciding all by itself (and not telling you) to bypass your own dns and hop off to the Google dns servers.

It's very naughty.

If you want to suppress that, you can either change a setting in your browser via a simple switch or flag (details on request) or go the whole hog, as I did in the end, and tell your Virgin router never to allow access to 8.8.8.8, 8.8.4.4, and even, again as I did, to 1.1.1.1. It's in the advanced/security settings.

And then you find it tries once again to get past THAT, so you have to kill the extra naughty one.one.one.one address it decides to try. So block that one in your Windows hosts file or PiHole as you prefer.

Those 1/ones are the Cloudflare server. You might prefer to keep Cloudfare for other reasons of your own of course.

It's like whack-a-mole sometimes, but I think doing all that locks you down pretty tightly. I know I can get a bit obsessive about it all, but it's kind of fun to occasionally see an ad or popup appear and think, aha, you little beggar, how did YOU get through, and track it all the place to see what's happening and why.

I knew nothing about DoH before all this, so I've learned something.
 Home Assistant - smokie
Home Assistant is a powerful Pi app which improves, and more to the point centralises, control over your home automation devices. There are two flavours, one requires a dedicated Pi, the other runs as a Docker instance. I have the former.

It can be quite complex if you want it to be, or quite simple. I have a dashboard on my phone (and other devices) to turn switches and lights on and off but you can set up scenes, sequences and automations. It is a community written thing and is mostly free. You can set it up to be able to manage stuff remotely if you want.

It supports a wide range of manufacturer devices and in the main gives you at least equivalent if not better control than the manufacturer app.

www.home-assistant.io/
Last edited by: smokie on Sat 20 Mar 21 at 10:33
 Home Assistant - smokie
Mine pretty much controls just lighting in the lounge, garage, kitchen and bedroom, and switches for my printer, screen, two TVs and soundbar, the dishwasher, car charger and the kettle (rarely used) using combinations of manual & voice control (Google Home) and also light level and motion sensor, and of course interdependency between devices and automations.

So one (spoken or button) command turns on the lounge telly and soundbar and another turns on the lights (although they come on anyway 45 minutes before sunset), but a single command will turn it all off at bedtime, tell you tomorrows weather and wish you goodnight. I have fall-back automations to turn the lounge off at 02:00 in case something is left on.

It can also tie in with the Octopus time of use electricity (Agile) tariff and you can request xx number of 30 minutes slots over the next yy hours and state whether they need to be contiguous, and it will work out the cheapest times and switch your devices - I have used it for the car charger but it isn't practical with my current car as it beeps when the power goes on. I also used it with the dishwasher. github.com/markgdev/home-assistant_OctopusAgile

I have it integrated with our phones so you can do stuff like turn off the charger when the phone battery reaches 100% but more usefully you can use geolocation to determine where each phone is - so you know that we are both out so the lights don't need to come on, or we are within 1km of home, travelling towards home, so put the lights/kettle on (you have to think ahead re the kettle, to fill it and turn it off before you go out!), or send an automatic message when you reach a defined place.

Loads of people do a lot more than I ever want to, controlling heating, cooling, blinds, garage doors, hot tubs, pet feeding, plant/garden watering etc etc. It's been a fun lockdown project for me.
 Home Assistant - Crankcase
I'm interested in this one as well, but...

I'd like to achieve Mrs C saying "watch the tv" and then the tv comes on and the amp comes on, set to the right things. I don't think I can do this with the kit I have.

Both the TV and amp come on in standby from power off. I imagine I'd need to set up some sort of infra red sender controlled by Home Assistant, and that means another box and wires (instant female veto in the lounge).

So if I were to be buying a new tv and amp, are there buzzwords to look for, technology built into them that would make this task easier? And as I type, maybe the answer is an Alexa enabled tv and amp. Are there such things that work?

As to the routines and set times for lights and things, I think I do all that with Alexa and a couple of Chinese smart plugs for a tenner each (and yes, I have blocked them sending stuff back to China with pihole...)
Last edited by: Crankcase on Mon 22 Mar 21 at 11:25
 Home Assistant - smokie
You can get WiFi and Google/Alexa-friendly versions of most home appliances now.

The problem of older devices not being in the desired state after power up is irritating. But with specific regard to the telly, someone mentioned a device on here (IIRC it was so they could remotely set their elderly parents TV back to BBC if they'd been fiddling) which I bought. It certainly works with Home Assistant (or with it's own app) but it's yet another "project" where I bought it, set it up and have done absolutely nothing further with it.

As that one may be of interest here I'll put it on a bit of priority. It's a Broadlink device, one of these tinyurl.com/ytt8fedc but I got it for less than a tenner.
 Home Assistant - Crankcase
Thanks for the link. Ironically, Pihole blocked it...

Found it though, looks like fun but it's a box too many really. Unless I can sneak it in somewhere.
 Home Assistant - smokie
... and a WiFi button pusher! Whatever next!!!

tinyurl.com/566fjf5n
 Home Assistant - No FM2R
Ahem.....

imgur.com/tqri6g4

Edit: Actually that's very small. What is says is blocked because of a tracker: viglink.com
Last edited by: No FM2R on Mon 22 Mar 21 at 16:01
 Home Assistant - smokie
Yep, my VPN (NordVPN) blocks it too. And as far as I can see it has no whitelisting available. All I do it turn off the VPN for a minute. I guess I end up being tracked.
 Pi Zero camera - smokie
I have a couple of cameras. I use MotionEyOs software which is easy to install and maintain. github.com/ccrisan/motioneyeos/wiki . The software allows you to save directly to NAS so I don't have to remember to take out the SD card every so often to back up the pics.

I've used them for motion detection based video through a front window (so the street, traffic, passers-by and front of houses opposite) but it soon becomes uninteresting. I have an infrared extra which is supposed to allow night filing but it needs to be too close to the subject to be of use as a security camera.

I put one down by the late cat's feeding bowl for a day or two and have some footage of his scoffing his food.

Last year I dangled a camera into the propagator where I had sunflower seeds growing and, taking stills I think every minute, I caught a great overnight sequence of a seed coming through the soil and growing using time lapse software to knit the photos together. i think I already linked to that here but here it is again drive.google.com/file/d/1K-m8r3Njy53FHLorI5R-Vx8Bczvi-weL/view?usp=sharing

So developing that idea, this year I have one pointed at each side border of the garden taking a still every 10 minutes (way more than I need but it's so much easier to delete some than fake missing ones!) so I can do a video of the rise and fall of the plants.

I expect they will spend next year back in the box of bits. They're not much good really, poor quality and no sound, so I have a WiFi camera which pans/tilts/zooms which is more fun.
Last edited by: smokie on Sat 20 Mar 21 at 13:02
 Misc hand cranked projects - capturing remote data - smokie
A mate wrote me a PERL program to retrieve my half hourly electricity consumption from Octopus into a CSV file. I've heavily expanded it so it also writes to a single file with all dates in it, from which I can do pivot tables and graphs to analyse and compare my electricity usage.

So with the general principle of how to use APIs to hand I was able to write a fresh program to extract the generation data from my solar panels.

Many other nerds have this kind of information completely integrated along with their power consumption and their electricity export data, and have all kinds of fancy graphs and info. Quite what they do with it all I'm not sure - I've gone quite far enough with mine!
Last edited by: smokie on Sun 21 Mar 21 at 14:21
 Plex server - smokie
Plex is a media server where you can catalogue your media and theoretically play it from anywhere. You can also reach other media sources through it. It can be run on many platforms so I thought I'd try it on the Pi, as it has spare capacity.

www.plex.tv/en-gb/

I don't have a need for Plex - if I want any of it when away from home I tend to put it on a disk. But I have some media to try out on it.

To me, the Pi doesn't seem to be powerful enough for Plex. I can't even remember what the exact problems were, I think the network connection is too slow for streaming and also it can't transcode on the fly. It certainly didn't work very well.

So, like many of my projects, as it didn't work right away I've put it to one side. Quite a few projects are only done "because I can", or for the challenge of getting them to work. I don't have any use for most of them.

But it beats watching afternoon TV or gardening.
Latest Forum Posts