MOTHER - Day time darkness

programming smarthouse sensors

One problem I've continuously had with MOTHER for the past year or so is that of dark days. I have a particularly darkly-decorated downstairs hallway (black pattern wallpaper with oak wooden flooring). On a particularly dismal day in the UK, this hallway gets a little dark, and what I'd really like is for MOTHER to realise it's a bit dim and click on some of the hallway lights.

All sounds simple in theory - 'if down_hallway_sensor_lux <= [adequate light level] then down_hallway_lights.on = true', but the problem arises when you actually follow through on that. For example:

  • down_hallway_sensor_lux is currently 40. Adequate light level is 50. Cool - we should turn on that hallway light as it's dark!
  • down_hallway_sensor_lux now reads 75. Adequate light level is 50. Hmm, it's light enough, so we should turn off that hallway light!
  • down_hallway_sensor_lux is now 40 again - rinse and repeat!

I think the solution is either to have some kind of sensor external to the systems above give the light level outside, and convert that to 'what would it be in the hallway. This way, turning on or off the light won't trigger the opposite.

Another way might be to have a timeout. ie. only do the above logic once every 30 minutes if something changes. This could still result in lights flicking on and off every 30 minutes, though, which is not ideal.

Last solution I see is to track the down_hallway_lights on/off state and factor this in. Not thought too hard into how this would work, but some kind of upper/lower limits that are used depending on lights being on or off.

Who I am

I'm Blake and I like to tinker with things and make stuff. When I'm not programming or developing random systems, I'm playing with electronics, doodling bits of art, 3D modelling or sculpting and painting things or nerding out watching sci-fi or horror TV.

From 2001 I worked in the games industry, eventually specialising in tools to aid in the development of video games and their engines. In 2011 I left the industry and teamed up with a few other talented composers to utilise my knowledge to help build the company 'Spitfire Audio'.

I also periodically compose soundtracks for video-games and have worked on titles such as The Stanley Parable and Portal Knights. You've probably also heard my music in random TV commercials at some point.

What I'm using to develop

If I'm needing raw power, I'm most likely utilising C++ in Visual Studio 2008 (I know, I'm behind the times).

To knock up quick and effective systems, I'm usually using nodeJS in Visual Code.

If it's games stuff, you'll probably find me pottering about with Unreal Engine with a mixture of C++ and Blueprints.