Wednesday, April 27, 2016

Node Red: Forcing numeric comparisons in a Switch node

I've been learning and using node-red to control a relay that turns on my car charger (technically an EVSE, the charger being in the car itself) and one thing I discovered as that the Switch node doesn't enforce any specific type for the comparisons. A bug was reported and a change made in a previous version, for details see, but this was then removed when new features were added to the Switch node.

How this causes problems is if your numbers have different lengths and the default msg.payload type is a string; then 850 is greater than 2000.

The solution I found was a very simple intermediate function that just changes the type of the msg.payload to a number. Put this in front of your Switch node and all works as expected:

save image

Long delayed update

It's been sometime since I posted anything here. Social media and forums means that much of the stuff I'm do get mentioned there in the first instance. I am going to try to make the effort to post here too and in more detail if for no other reason than to have a long lived and locatable instance of all this stuff that I think may be interesting.

Thursday, April 10, 2014

Streaming a Geovision IP Camera to Youtube with avconv

Just a very quick note on the command line I have used after much googling to send my camera stream from a Geovision GV-BL2410 to YouTube Live. The secret was forcing a silent audio stream, which was the step I had previously missed (all on one line):
avconv -v quiet -rtsp_transport tcp -i rtsp://[RTSPIP:RTSPPORT]/CH001.sdp -b:a 128k -f s16le -ar 44100 -ac 2 -i /dev/zero -codec:v copy -codec:a aac -f flv -strict experimental "[YOUTUBEURL]/[YOUTUBESTREAM]"
Obviously replace RTSPIP, RTSPPORT, YOUTUBEURL and YOUTUBESTREAM with your specific values. The YOUTUBEURL will be the one that starts "rtmp://..."

Tuesday, November 5, 2013

Adventures in record cleaning

I've been buying far too much used vinyl in charity shops over the past few months and no matter how filthy or clean these new audio treasures are they never go near my stylus without a full wet clean. Originally I started by using the Knosti Disco Antistat record cleaner and their own cleaning fluid, but at £20+ a litre bottle, with the occasionally cheap deal hitting £15 it was becoming expensive. The fluid can be re-used but even with filtering through the basic paper filters they provide (5 with each bottle) the recycled fluid is full of dirt - and worse the particles that make it through the paper filters are small enough to get left in grooves. I've been thinking that there must be better and cheaper ways to do this.

Sunday, September 23, 2012

"Oh, another thing about stylus down-force..."

Collecting again. Stop it.

Those who watch my random musings on Facebook will know that I have been buying and inheriting more and more old vinyl from charity shops, friends and colleagues. My small collection of old 80s records has now grown to about 5 times the size in the last few months. So, I'm going to slow down with collecting more as there is simply neither enough storage space nor enough listening hours.

Friday, September 21, 2012

Thinking about stamps and data models

I am in no way formally trained in relational databases, data modelling etc. but I am a couple of pages ahead of some. Having said that I think all that does is give me better opportunities to shoot myself in the foot, more quickly and with better accuracy.

So, that disclaimer out of the way, I've been thinking about how to represent a stamp catalogue and collections in a SQL database. I've been playing with MySQL Workbench as a simple design tool and while it's cute it takes quite a lot of work. A sheet or paper and a pen is a bit simpler at this stage.

So, what have I got so far? Not a lot to be honest. Below are some potentially incoherent ramblings and comments are welcomed.

Tuesday, September 18, 2012

Stamp Collecting ... Again

After an opportunity to visit IKEA once again I recently reorganised my furniture so that I had deeper and better shelving near my home office to move my stamp collection to. I use the term "collection" quite loosely as it turns out as it's more a hoard. Like many I started as a child with stamps from my parents and buying interesting packs of used stamps from bookshops and newsagents. As my family is from Hungary I also used to visit in the summers when I was growing up, and in those days - mostly the 80s before the Iron Curtain was pulled aside - there was a good selection of new issues and related materials available in Budapest especially in the official Hungarian stamp outlet in the tourist district.

Since then I acquired a variety of large sets of stock-books, collections and random boxes of stuff from a variety of real auctions in London and on-line in the early days of eBay - which I would now not go near as it's simply a hotbed of fraud and scams. Every time I progressed in sorting things out more material appeared. It's been a number of years since I last had a proper go at consolidating, classifying and recording what I have and I have decided it's about time to start again. Again.

Now that the world has moved on and on-line is the way forward I have looked for, in vain, a good resource to help me catalogue my collection. There are a variety of sites and services out there and a lot of work has already been done by Keijo Kortelainen one his rather excellent site - one page in particular has been very useful: Stamp Collecting Blog - Software & Services. However what I have been looking for is something much more akin to the functionality, community and openness of Discogs but sadly there is nothing. So, in the spirit of the nerd I am going to see what I can knock up as a starting point and see what happens.