Node-Red BigTimer Example

I am constantly asked about using Bigtimer (node-red-contrib-bigtimer) and so here’s an example of how I am using it in conjunction with both Amazon’s Alexa (voice control) – and the Node-Red Dashboard.


So in this example, Amazon Alexa is being used courtesy of HA-Bridge – which is part of my normal setup for any Raspberry Pi or similar device, along with Node-Red itself and Mosquitto for communications.

Here we see my cabinet timer. Essentially I have a drinks cabinet which lights up with internal white LED strip from dusk until I think midnight.  The first output from the Bigtimer goes off to MQTT (no particular reason why in this case it goes off to a separate node) and quite happily runs automatically as-is.

For any number of reasons I may want to override that lighting. For example if I decide to have an early night, I may want to turn off that and other lights. I can simply say “Alexa, turn the cabinet off” to over-ride the timer settings.

Overrides on the timer work by sending one of the following to the input of the timer.  1, 0, “auto” – the latter of course simply returns the time to it’s auto state. The overrides are only good to the next auto change of state (deliberately).

So in Ha-Bridge I have 2 simple settings – on and off. I’ve added the Mosquitto utilities to the mix so that I can send a message via the command line – and this is how I do that in Ha-Bridge. Below you see the setup for the cabinet.


As you can see my password is blurred out.  So Ha-Bridge on hearing “Alexa, cabinet on” or similar, sends a command line message to publish a message of topic “alexa_cabinet”  with the value 1. For those unfamiliar with the mosquitto_pub application – P means password, –u means user, –m means message and as you can see I’m using a local MQTT broker (Mosquitto).

This is picked up by the MQTT input node and fed straight into the BigTimer input as is the Off command.

I wanted, in addition a control for Node-Red Dashboard as Alexa is only good if you happen to be in the same room as the Amazon device…

Node-Red Dashboard

If you look at the first image you will see the middle output of the node feeds into the Node-Red Dashboard “Cabinet ON/OFF” control –  this is to ensure that (once a minute) the dashboard on-off control actually reflects the state of the output whether on auto or manual override.  The actual outputs of the control  send 1 or 0 (or in the case of the blue button “auto” to MQTT – to the same topic – i.e. “alexa_cabinet”. Sadly Ha-Bridge is very restrictive in what you can actually do so it is not possible to say “Alexa set cabinet to auto”. This can be done by other means but they are currently a little messy.

This of course is only one of several devices I have using this technique, it works well. So above you see an example of using MQTT along with both Alexa and buttons to control an output without having to store any global state variables etc. Simple.


25 thoughts on “Node-Red BigTimer Example

  1. OK, another quick question on BigTimer. I’ve got it set to turn on at 2AM on Tuesdays and Saturdays. I’m sitting here at 9PM Tuesday evening and the status display is telling me it will turn on in 5 hours (i.e. 2 AM on Wednesday morning). I’m thinking that once Wednesday rolls around, the status display will correctly reflect the next scheduled On time (next Saturday). Any ideas?

  2. Good morning, Pete. Thanks for a great timer node in Big Timer, I’ve used it to successfully repair my aging water softener! One issue is that it appears that the manual overrides won’t function if they are not triggered on one of the days the timer is set to run? i.e. if I try to send an ON on Sunday, and the Sunday tick box is not checked, it won’t run? If so, I can get around it, but I’m just wondering if I’ve got it configured correctly or not? Thanks again!

    1. See recent updates.. two types of manual. Simple overrides wont work on days nothing is set (by design) – first inject “manual” to go for full manual.

  3. First Bigtimer is very, very nice timing node, I think this is the best customizable node. I’m using it everywhere probably in 6-8 different flows.
    Recently start using BigTimer for MiLight node to turn led lights on and off but this is the only hard function for on or off only (or different value).

    Now, I have the question: is there any way to add or do something to change output in time from 0 to 100 (any number)? I need to change the brightness of led lights?

    Example: start with zero at the dusk, and in two hours reach 100% brightness.
    I hope this is clear, sorry for my English, foreigner here.

    1. Not really the function f a timer. Stick a function on the output to control level depending on your requirements.

  4. Hi, I have quite a few flows that I would to time bound. I do not see an apparent method to add bigtimer in series so the existing flows only execute when combined with a schedule from Bigtimer. I’m not an adept node.js implementer and find the solutions are right in front of me most times, I just don’t think the way node.js requires. Any hints?

  5. Thanks. It’s not imperative that I have the info. More an information thing for the end user, showing when sunset or sunrise will occur. I don’t want them to need to access Node-Red. I suppose I could show the data on a table that indicates sunrise/sunset times and let them use that as their guide.

    1. There would be a million ways to get an output on the dashboard, if the information were made available on the output of BigTimer, but as there has been no interest in such a feature to date I’ve not made that available. You can of course see the remaining time on the node itself.

  6. Hi Just to affirm what William Miller said above about Alexa Home Skill Bridge. Its a very good node-red module that takes things beyond HA-Bridge. For instance with the Thermostat you can ask for the current temperature and setting as well as change settings and get spoken confirmations . The clever part though is that you can manage the responses – so for instance you can set an acceptable range of thermostat settings and if your command is outside the range Alexa will respond that she can only accept settings from x to y. It also manages door locks and they have said they will extend the lights options to include colour and warmth. It does require an external connection for authorisation but Alexa is of no use without internet anyway. Short of developing your own skills and setting up secure links this is an incredibly easy and quick way to extend Alexa to thermostats and locks as well as simple on/off/dim devices. It is easy to setup as I say but the response API can be a bit finicky so if you want the flows I have already done I can send them.

    1. Steve

      I am about to head off to take a friend to the airport, returning tomorrow night- but I am VERY interested. Right at the start, two of us wrote out own SKILL because none of the solutions including HA-Bridge offered things like user-settable response – instead returning the old OK which is about as much use… giving no real indication as to whether what you’d said had worked or done something completely different. I hit a snag where our solution required HTTPS: and worse on port 433 ONLY – as my provider in Spain uses 433 for remote access and won’t budge on that port I had to abandon our own SKILL and use HA-Bridge.

      If this skill you refer to allows me to do my own responses but does not demand that the local site can handle port 433 HTTPS access then this would indeed take it’s usefulness FAR beyond HA-Bridge. I’d also like to handle colour control which I can’t currently do on HA-Bridge.

      Please do furnish as much information as as you have time for and I’ll take a look on Friday.

      1. Hi will explain the setup and current options and you will find it very straightforward. The exact range of responses possible are as per which are pretty extensive and may be extensible. I can send the flows that I have if it will save some time and the Alexa channel on the node-red stack account is a good source of info

        1. Sorry to jump in the middle here but I’ve been playing with Alexa Smart Home Skills (I’m in the US) and I have both good (mostly) and a bad experience. I have a switch, a lock and a Thermostat setup (using MQTT as the devices). I have been able to lock the door but Alexa won’t let me unlock it. I did setup node-red to confirm that the door is locked before telling Alexa (yea!). I’ve been able to feed the room temperature to the MQTT topic for the thermostat so I am getting live temperature readings and it handles the set/get of the settings well.

          I did have an issue when the UK link got a bit wonky in the middle of the night (UK time). A visit to the site showed it slow to respond (Maintenance?). This is an issue with all cloud based HA so it’s not unexpected.

          The other bad (not really bad) experience was the documentation. I found that the Alexa web site explained the skills a bit better which allowed me to get the responses bad. What I also found was when Alexa sent the lock command I needed to node-red, I needed to copy the json to the context so the response had it for the response.

    2. Thanks for your comments and links to other info Steve. I often feel out of my league on this forum as I am new to this technology but because of people like Pete and like you I am expanding my knowledge rapidly. I look forward to further posts and comments.


      1. The great thing about this fast moving and diverse field is that after 3 months you can be considered an old hand. On the other hand take a break for a few months and you fee; like a dinosaur.

  7. Thanks Peter,
    Now all I need is a echo as Australia doesn’t have them yet. Plus how to pull a node un to control one. William do you have a youtube channel on how to do it?

  8. Hello Peter

    I have had a great deal of success using Node-Red Alexa Home Skill Bridge which operates in a fashion pretty much identical to what you describe. I use big timer to automate lights on and off and use an Echo Dot to give me over-rides to those settings if I want individual or groups of devices on or off. Just my 2 cents, but this technology really excites me and “gets me up in the morning” as you say in your blog…

    Bill Miller

  9. Hi Peter,
    So HA bridge is in your script ? Great write up as alway. Still waiting for Australia to get the Alexa dots on sale here.

Comments are closed.