Goodbye Tuya it really hasn't been great knowing you.

Over the last few months I have been playing with esp32 and esp8266 devices. For those that don't know, one of these amazing chips is embedded in practically every smart device you own, your lights your sockets, anything you control from the smartlife app on your phone/tablet probably has one of these things. These wonderful little chips run a program that you can upload to them and that can be any program. My pet project at the moment has been "BigButton". The code for this lives here: The idea is that disabled kids can use it as a device to control a socket, which might control a light, or act as an alarm, it's actually quite surprising the uses you can make of a single button with an LED in it! Anyhow I digress, almost all of the devices you buy such as smart sockets are integrated with the tuya cloud service rather then being controlled over the the local network. I have been making open source contributions to help contro

Arduino esp32 thermistor project

 My first actual arduino project. Based on: the code is here: My little extra is to realise that thermistors are quite prone to interference and whilst a capacitor might help, so would taking an average of samples. I plan to add an LED readout as well as the simple REST api.

Arduino boards - what I wish I'd known when starting

 Arduino boards are an alternative to raspberry pi boards, for projects that involve custom hardware IO. For example a simple thermistor attached to take temperatures. For that kind of application a full blown computer like the standard raspberry pi range is obviously massive overkill. Well frankly for the purpose of reading a thermistor so is Arduino.  But they are cheap as chips. My starting point was 3x esp32 boards for £21.95 with inbuilt wifi and bluetooth. It's hard to argue at those prices. The boards are at that price clones, but that's the point really, it is an open hardware standard. As such there are a great number of variants. Code written for builtin wifi won't be quite the same for a board where you have added a wifi shield. So how do you program them? Remarkably the default language supported by the public IDE is C++ and as an important note, if you download this for windows, get the full version don't get what the Microsoft store offers you, it lacks ev

Cleaning media filenames

I have noticed over the years that Kodi falls down badly when it comes to getting media information. If even one file in a folder is not "properly" named the entire directory doesn't get imported. I was a little tempted to try and patch the Kodi source code, but frankly it's a little complicated to understand. Instead I thought I would play a little more with node-red: Gives you a flow you can import and which is entirely harmless until you connect the final rename node. It scans down folders and strips out all but the essential information in the filename.

node-red a full home automation example

 I'm not putting this publicly on github quite yet, though feel free to ask. It is my attempt to put my home automation on a dashboard integrated with Alexa, Logitech Harmony and in these days of scary fuel bills my solar panels and consumption monitoring smart plugs. You may or may not want my flows in all their glory, it is my house after all, but the following bits are of note. A reliable Tuya authentication mechanism. Solax solar cloud REST reading. A much extended set of harmony remote integration nodes compared to the original node-red-contrib-harmony repository I forked from. A way to read whether a Virgin TV box is on or off so a power toggle can be sent correctly. Hue lights control. Nothing special but might be easier than starting from scratch. A more useful version of the "sum" node that helps with power aggregation functions. Examples of using the alexa-node-red package so I can talk to Alexa and start node-red flows. A flow to turn an immersion heater on whe

node-red flow my tears the progammer said

 Having got a couple of weeks of node-red experience. I feel qualified to get a little critical. In my first post on node-red I did already find reason to complain about the lack of namespaces, there was a conflict in my project meaning I failed to access node-red-contrib-crypto-js-dynamic, my code instead called node-red-contrib-crypto-js and failed. My next target is the "flow". Flow is misnamed, there are flows of information through node-red, but what is called a "flow" is simply a named tab where you may put many different flows. If you choose to store information in a flow, you are storing information on the equivalent of a big piece of paper.  Once that piece of paper is full and you need a new one, then your new bit of paper/tab/flow will no longer have access to the information on your first bit of paper/flow/tab. Your only real resort is to use the global context. Both of these issues are a classic case of ease of use, hitting the threshold of big boys/gir

A reliable tuya authentication in node-red

In passing when working with tuya and node-red I had a couple of issues, the first one was conflicts with node-red-contrib-crypto-js-dynamic and node-red-contrib-crypto-js. node-red just doesn't seem clever when it comes to duplicate node names. In this example I have replaced the "hmac" function with a copy called mj_hmac. This can be replaced with the hmac from node-red-contrib-crypto-js-dynamic or failing that you will be unable to pass the tuya secret key as a parameter and will have to enter it in the hmac node dialog. The second issue is that tuya authorisation is on a fixed timeout of two hours.  If you refresh the key at 1 hour and 59 minutes it will only be valid for 1 minute. This flow keeps track of the time remaining and refreshes just after expiry. I have not seen errors since. However as a backup plan I do have sub flows that if they see an error reauthenticate. If anyone is reading and interested I can post them as well. [ { "id" : &qu