Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Urban 21:48 on 28 Apr. 2020 Permalink |  

    Cassandra auto-expiring data 

    Just found a beautiful feature of Cassandra — a single update that:

    • performs an upsert (insert or update), so there’s no need to check for existing data
    • ensures items are unique — because we’re using a set { … }
    • and takes care of individual item expiration: each item is valid only 2 weeks, after that it is removed, and when there are no more items left,  the row is removed as well
    UPDATE covid_contact_tracing USING TTL 1209600 
    SET people_met = people_met + {'alice','charlie'}
    WHERE user = 'bob';

    Seems to behave exactly as expected:

    • If Bob meets Alice multiple times, each time Alice’s the TTL is reset to 2 weeks
    • After 2 weeks Alice indeed expires and is removed from the set
    • When all contacts expire, Bob is also removed

    There are drawbacks, however:

    • There’s no way to query a TTL of a collection (set/list/map) item — so you can never know how long it has to live. Or if it has a TTL set at all.
    • If you have existing items without TTL, they have to be reinserted with TTL; this means tons of writes, but at least the whole set can be reinserted at once.
    • This breaks idempotence of writes: you cannot have a job to replay writes (for example, from multiple sources to decrease probability of missing items), since this would reset the TTL
  • Urban 22:33 on 29 May. 2017 Permalink |  

    A tour of Menger sponge 

    Done as a WebGL shader. Runs much smoother than a comparable implementation in three.js

    Direct link to Shadertoy, in case the embed doesn’t work.



  • Urban 20:14 on 11 Jan. 2017 Permalink |  

    A glimpse of Sri Lanka 

    To my great surprise (and delight), one of my shots from Sri Lanka was published in the December 2016 issue of the National Geographic Slovenija magazine 🙂



    Below are some of my other favorite shots.

    20161029-IMG_3587b 20161029-IMG_3615b 20161029-IMG_3686 20161029-IMG_3833b 20161031-_MG_4160b  20161105-_MG_6066

    This was a serious photo tour (and an awesome group of enthusiasts), which means we were snapping like crazy. But I still have a long way to go 🙂 More photos.

  • Urban 15:41 on 11 Jul. 2015 Permalink |  

    Torpedo marmorata 

    During vacation snorkeling I stumbled upon an electric ray. I was perplexed by its odd looks, and the fact that it seemed eerily undisturbed by my pursuit. Which is why I left it alone.

    Here’s a pic, and a short clip, taken with a modded GoPro Hero21.

    Marbled electric ray

    I had some trouble looking it up afterwards, but this nice guide helped me — it seems to be a marbled electric ray2. If I knew they were that common in Croatia, I wouldn’t have gone so close; supposedly they can produce a 200V discharge3, and on youtube you can find clips of fishermen getting shocked 🙂


    1. fitted with a mock underwater flat lens, made from a wide (Cedevita) bottle cap and a cheap kids’ diving mask; the aged Hero2, which I bought for the sole purpose of underwater photography, was completely unfit for it, despite having the housing rated for 200m–the original curved lens produced blurry images.

      Here’s a pic of the mod:



    2. also, Torpedo marmorata. It must be really common, since it has 8 names in Croatian: drhtulja šarulja, mramorna drhtulja, trn, trnjevača, tresnavka, banjača, pjegava drhtulja, renjok; see here []
    3. see here  []
  • Urban 20:50 on 31 Oct. 2014 Permalink |  

    Smart thermostat shenanigans 

    Winter’s coming and this year I set my mind on installing a smart thermostat. I’m used to unexpected problems with tech, so I wanted to have it set up before it actually gets sufficiently cold outside that experimentation will cause me discomfort. Which means it’s now or never.

    I briefly looked into 3 options:

    • Nest, the epitome of a smart thermostat (acquired by Google)
    • Netatmo Thermostat, made by the French Netatmo, most known for its weather stations
    • Tado Smart Thermostat, made by Tado, a german HVAC startup
    • I also checked a bunch of other (locally controlled) options, of which nothing captured my attention

    To distill some of my findings (please note I’m doing this from an EU perspective):

    • Nest
      • [+] definitely tries to be smart; uses a motion sensor and a learning algorithm to find patterns in your away-from-home time
      • [+] the API looks pretty comprehensive & well done
      • [-] but it’s bulky and heavy
      • [-] and optimized for US heating standards & boiler interfaces (runs on 24V AC)
    • Tado
      • [+] supposed to work with most EU heaters
      • [+] the app reports distance from home to a server; when you get closet to home, it gradually increases the temperature (pretty clever)
      • [+] also supports plain old daily schedules for people without smartphones
      • [-] no activity detection
      • [-] no display or buttons, entirely app-controlled
      • [-] the most expensive of the bunch, but rental option available [+]1
      • [-] no API (none that I could find)
    • Netatmo
      • [+] supposed to work with most EU heaters
      • [+] relatively cheap
      • [+] nice design
      • [+] has an API
      • [-] the dumbest of the bunch (no sensors, no AI)
      • [-] just a web-based and app-basaed heating schedule editor

    I found out pretty quickly that Nest won’t cut it with my heating system. I don’t have 24V AC on my heater, and no AC power near my old thermostat mount location. In addition, the device itself felt pretty heavy/bulky. Last but not least, it’s Google-owned, so all the data about your physical presence and heating schedules will reside on the Google’s servers.

    So it was in fact a run-down between Tado and Netatmo.


    I liked Tado’s approach, but didn’t like the design of the device: no display, just a single “emergency” button to let it know that you’re home (e.g., if you happen to forget your phone at work). Monitoring the GPS position of all your family members to determine when to turn on heating is pretty clever and probably brings the largest possible amount of savings: even if you deviate from schedule, Tado still knows when you’re coming home.

    However, I can’t help but think about what can go wrong if you let your heating be controlled by a stack of unreliable technologies:

    • you have to have the phone on you (if you forget it at home, heating stays on; if you forget it at work, it stays off; nonetheless, that’s a pretty minor issue, since I rarely forget my phone)
    • but my phone battery dies relatively often; what then?
    • or what if you don’t have connectivity
    • or if the app’s GPS logging fails (i’ve experienced a lot of this with GPS logger apps, at least on iOS)

    On the plus side, Tado seemed to have some smarts regarding taking into account the outside temperatures, pattern detection (not much info online there), and it did specifically support my 3-pin (7-8-9) terminal of the Vaillant heater (which I saw in the installation video, no other documentation found).


    Netatmo looked quite nice, but the situation regarding available information online was even worse than with Tado. It seemed the dumbest of the three. The site shows nothing but HLB marketing, without any technical details. There’s no info about the features,  about what happens if you lose WiFi connectivity, or if it integrates with the Weather station. They do have a demo GUI that allowed me to play with a fake thermostat to get a feeling about what’s possible. I also had to dig deep to find it has an API that allows you to add some brains on top of it with your own app. And the fact that it took the original Netatmo Weather Station website quite some time to switch from HTTP to HTTPS was not really demonstrating the security savviness you’d like to see, if you want to let other people control your heating.

    However, in the end I did order this one–primarily based on the low price, appearance, and *claims* that it supports my heater brand (there was just a logo on the website). Not much info online here, just the video installation instructions that show it has a simple 2-terminal on-off switch, which I thought could be somehow connected to my Vaillant heater 7-8-9 terminal.

    Netatmo installation

    The first surprise was that I couldn’t get it to work in place of my old room thermostat. As it turns out, Vaillant 7-8-9 terminal is a potentiometer that gradually changes the voltage from about 11V (off) to 21V DC (full throttle) to regulate heating. This terminal cannot be easily linked to a single-pole switch. Arguably it could be connected to a 2 pole switch to have either off or full throttle.

    Luckily, the package comes with everything necessary for another mode of installation: It can be connected as a relay directly to the heater.

    In fact, the wifi relay comes with 2 backplates:

    • one is a socket plug, to connect it directly to mains. In this case, the “relay” acts only as a WiFi-to-radio relay and sends commands to the room thermostat module. In this case, the battery-powered room thermostat turns heating on and off.
    • the other one is a 4-wire connector that can be connected directly to the heater. Two wires (240v L+N, blue and brown) are connected to mains power (inside your heater), and the other 2 wires (black and grey) are connected to the relay connector of your heater.

    My heater (as probably every other Vaillant, I’ve checked a lot of online manuals) has a 240V relay connector on pins 3 and 4; they are normally bridged with a wire, which means that this 3-4 “switch” is always on, and heating is controlled through a room thermostat on 7-8-9. However, if you disconnect your room thermostat (i.e., all 7-8-9 wires are in the air, which means ON), the heating is controlled only through 3-4.

    Bottom line, I connected Netatmo relay adapter directly to the 3-4 terminal, and the power wires (240V) to L+N (both inside the heater). I also left my old room thermostat in place. This means both need to be active for the heating to turn on (logic AND). In my case this is easily solvable, because my old room thermostat can be set to “always on”, and this would mean the heating is controlled by Netatmo alone. But in addition, it gives me some peace of mind, because I can limit max temperature on the existing room thermostat as well, and prevent Netatmo from going berserk, turning on and heating the house to 30 degrees. (hey, it’s a cloud-driven thermostat, anything could happen)

    Post-install and first days

    I was pleasantly surprised by some of the features that are not mentioned anywhere on the web (in Netatmo’s defense, they do have a forum that I only found later:

    • It does work when WiFi’s down; it just follows the last schedule it knows
    • It does integrate with your weather station; it fetches the temperature from the outside module of the same account and uses it for plotting charts and doing predictive heating
    • It *can* have the polarity reversed, which means I could even connect it to the room thermostat post (off = all wires in air = full throttle; on = bridged control wire and low voltage)
    • It has 2 modes for heating: hysteresis and PID; PID means it learns the time constant of your home, takes into account the outside temperature and starts heating earlier or later accordingly

    Below are some screenshots from the web app Q&A that are not accessible from the demo web app linked above.

    2b6d6eda394b7aa134d663fc54e18d2c ce022b5f046edfa67dda51c5ed592af4b7a44523628e9746aca1a44de7eb9f16   6daef66bdeb8bb3fca9f6ead8bb9ec0d1e7d9f5de56e194e34f1985dfef560a5

    1. It seems Tado just dropped the price by 50 EUR []
    • Julia 13:21 on 8 Jan. 2016 Permalink

      has anyone had any trouble with it? Mine doesnt seem to want to control the temperature. my heating on my other box has to be on all the time, but even when my thermostat says its off, it still heats my home to somewhere between 20 and 25. I thought I had it working the other day but it seemed to turn the heating on when i set the desired temperature UNDER the current temp, and off when desired temp is over current….so far its costing me money not saving it!

    • Urban 15:13 on 8 Jan. 2016 Permalink

      From what you say, it seems that your heater uses reverse logic (meaning that you have to open the circuit to turn on the heating). Try changing the “polarity” under settings (in your app, go to settings -> your thermostat (at the top) -> Advanced settings (at the bottom) -> Polarity –> set to Reversed). If this is the problem, it should fix it.

    • Shambolic 12:06 on 11 Feb. 2016 Permalink

      I’m having a problem with the thermostat not turning the boiler on first thing in the morning. My current workaround is to have it switch on and off twice in the morning, trouble is sometimes it catches on the first one and therefore comes on a lot earlier than I would like. have it currently in the place of my old thermostat, with the relay just plugged into a mains socket. Maybe if it was hard wired into the boiler it would sort things?

    • Urban 23:26 on 11 Feb. 2016 Permalink

      Hmm, that’s hard to say.. I’m assuming the temperatures check out ok, with the thermostat actually measuring a lower temp than you’ve set? (If not, you can set the offset under advanced settings).
      Maybe there could also be a connectivity problem between the relay and the unit? To check this you can try changing the temperature in the app manually, and if that reliably works, this also can’t be the problem.
      Other than that, I imagine something like the heating prediction could mess things up (this tries to be smart and take into account the outside temperature, which could be wrong). You can try turning this off if you use it..
      Lastly, hard wiring it to the boiler might help, in case there’s some kind of hardware problem in the thermostat’s circuitry..

    • Shambolic 12:34 on 12 Feb. 2016 Permalink

      It’s a bit of a mystery. Temperature is fine, it works manually and after the first turn on the timed setting are working but it just misses that first timed switch on. I’ve switched off the predictive feature, no change. All that’s left to try is hard wiring to the boiler.

    • Enis Erkul 17:41 on 21 Jul. 2017 Permalink

      Hello! I know its a little bit old entry but I bought a Netatmo Thermostat. Now I want to replace my old Vaillant VRT40 thermostat with the new Netatmo. I couldn’t really understand from your post, am I able somehow connect Netatmo using cables 7-8-9 from the old thermostat? Maybe I can boiler, I can swap cables from 7-8-9 to 3-4? I dont really want to connetct netatmo through a boiler. Are there any chances I could use 7-8-9 cables?
      Thank you advance!

    • Enis Erkul 18:52 on 21 Jul. 2017 Permalink

      Replying for my own question 🙂 Netatmo Forum, Official support guy answer:
      You will just respect this process:

      disconnect your current thermostat from the 3 wires of the wall.
      disconnect the 3 wires of your boiler (they should be connected on ports 7, 8 and 9 of the boiler).
      remove the bridge between the ports 3 and 4 on your boiler.

      To use it with existing wall-wires:

      connect 2 of the 3 wires you have disconnected on the first step on the ports 3 and 4 (no matter the cables you pick, there is no polarity), and insulate the third one,
      connect the Thermostat on these 2 wires on your wall.

    • Urban 19:06 on 21 Jul. 2017 Permalink

      Hey! This is just talking from memory, but I think the 7-8-9 is the low voltage connector, meant to be used with the battery-powered Netatmo room thermostat module. 3-4 is high voltage (240V), meant to be used with the separate 240V relay module, which is also a bridge between WiFi and the room module. (At least I have these 2 modules, I’m not sure if they still make it this way).

      In any case, if this is from the support guy it’s probably right 🙂

    • Scott Pattinson 10:01 on 23 Nov. 2017 Permalink

      Vaillants own product Vsmart is based on netatmo. The difference is that their product uses the 7 8 9 terminals so the thermostat can modulate the boiler according to need and outside temp. this helps to maintain the temp at s constant value the boiler can run at a low setting which must be better for comfort and boiler life. Using the terminal 3 and 4 you effictively are only able to have the boiler off or running full blast.

    • Peter 22:55 on 13 Dec. 2017 Permalink

      It seems Vsmart is for newer Vaillant boilers, not the old analog 7 8 9.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc