Skip to content

openHAB: timestamp from last Item update

If openHAB has a Persistence service configured, the time of the last Item update (and a couple other times) is available in Rules. This makes it quite handy to check if a certain item hasn't been updated in a long time. As example I have the Tankerkoenig Binding installed, and this data is persisted in InfluxDB. This way I can see historic gas prices in Grafana.

When the Telegram Bot answers the "/tanken" question, it appends the timestamp of the last gas prices update.

 

Continue reading "openHAB: timestamp from last Item update"
  • Twitter
  • Bookmark openHAB: timestamp from last Item update at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg openHAB: timestamp from last Item update
  • Bloglines openHAB: timestamp from last Item update
  • Technorati openHAB: timestamp from last Item update
  • Fark this: openHAB: timestamp from last Item update
  • Bookmark openHAB: timestamp from last Item update at YahooMyWeb
  • Bookmark openHAB: timestamp from last Item update at Furl.net
  • Bookmark openHAB: timestamp from last Item update at reddit.com
  • Bookmark openHAB: timestamp from last Item update at blinklist.com
  • Bookmark openHAB: timestamp from last Item update at Spurl.net
  • Bookmark openHAB: timestamp from last Item update at Simpy.com
  • Bookmark openHAB: timestamp from last Item update at blogmarks
  • Bookmark openHAB: timestamp from last Item update with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Online indicator for remote controllable power plugs in openHAB

Recently I installed a number of new power sockets (like this one). The Hue bridge can not only add each switch to a light group, but also reports each plug as a Thing in openHAB. There I thought it will be a nice touch if openHAB actually reports when it sees a device plugged in. The power socket has a LED which turns on when the plug is on. The Hue bridge reports OFFLINE and ONLINE. That's useful.

The plan is to turn the LED light - and the power plug - on and off for a few second.

 

Continue reading "Online indicator for remote controllable power plugs in openHAB"
  • Twitter
  • Bookmark Online indicator for remote controllable power plugs in openHAB at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Online indicator for remote controllable power plugs in openHAB
  • Bloglines Online indicator for remote controllable power plugs in openHAB
  • Technorati Online indicator for remote controllable power plugs in openHAB
  • Fark this: Online indicator for remote controllable power plugs in openHAB
  • Bookmark Online indicator for remote controllable power plugs in openHAB at YahooMyWeb
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Furl.net
  • Bookmark Online indicator for remote controllable power plugs in openHAB at reddit.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at blinklist.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Spurl.net
  • Bookmark Online indicator for remote controllable power plugs in openHAB at Simpy.com
  • Bookmark Online indicator for remote controllable power plugs in openHAB at blogmarks
  • Bookmark Online indicator for remote controllable power plugs in openHAB with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

openHAB: reset DateTime in rules

In one of my openHAB rules I'm using a timestamp to track when an Item went offline. This is used in my monitoring to let the user (me) know how long the Item is already offline.

Background: we have a couple ChromeCasts in our network. When they are connected to a 5GHz Wi-Fi they are quite unstable and often loose the network connection. Usually the openHAB binding reconnects the device quickly, but it happens that the device stays offline. It might have something to do with the router, but nevertheless I want to know when things go offline.

For this I defined a virtual Switch as DateTime:

DateTime	LivingRoom_OfflineSince		"Offline Since [%tY-%tm-%td%tH:%tM:%tS]"

When the ChromeCast goes offline, this Switch is updated in a rule with the current time:

LivingRoom_OfflineSince.postUpdate( new DateTimeType() )

 

However resetting the DateTime switch when the item comes back online proved to be a small challenge, the documentation is unclear. People write online about "UnDeftype", "UNDEF", "(unknown)", "UnDefType.UNDEF", "UnDefType.NULL" and a couple more.

In the end it's quite easy:

LivingRoom_OfflineSince.postUpdate(NULL)

Just update the Item with NULL. Don't use sendCommand() here, you only want to update the Item, not send a new command to a virtual switch.

  • Twitter
  • Bookmark openHAB: reset DateTime in rules at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg openHAB: reset DateTime in rules
  • Bloglines openHAB: reset DateTime in rules
  • Technorati openHAB: reset DateTime in rules
  • Fark this: openHAB: reset DateTime in rules
  • Bookmark openHAB: reset DateTime in rules at YahooMyWeb
  • Bookmark openHAB: reset DateTime in rules at Furl.net
  • Bookmark openHAB: reset DateTime in rules at reddit.com
  • Bookmark openHAB: reset DateTime in rules at blinklist.com
  • Bookmark openHAB: reset DateTime in rules at Spurl.net
  • Bookmark openHAB: reset DateTime in rules at Simpy.com
  • Bookmark openHAB: reset DateTime in rules at blogmarks
  • Bookmark openHAB: reset DateTime in rules with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Restic backup

Was asked quite a few times how I do my backups with Restic.

For more than 10 years I was using "Duplicity" for backups, but in 2019 I changed to Restic. The main reason for the change was that Duplicity still can't handle "Big Data", as in: larger directories. In 2009 someone opened an issue on the Duplicity bugtracker, and this problem still exists as of today. For about two years I was shifting around the problem, excluding files, trying to make the sigfile smaller. But at some point I decided that it is enough and I need to change the tool.

Duplicity knows two backup modes: "full backup" and "incremental backup". Once in a while you take a full backup, and then you add incremental backups to that full backup. In order to restore a certain backup you need the full backup and the incremental backups. Therefore my go-to mode was to always have two full backups and a couple incremental backups in-between. Even if something goes wrong with the latest full backup, I can still go back to the previous full backup (of course with some changes lost, but that's still better than nothing). When taking a new full backup, the oldest one is only deleted when the new one is completed. Accordingly when a new incremental backup is created, it's a new set of files. Removing the backup removes all the files from this incremental backup. That worked well, but needed scheduling. Over time I wrote a wrapper script around Duplicity, which did schedule new full and incremental backups.

Restic works in a different way. There is no concept of "full backup" and "incremental backup". Basically every backup is a full backup, and Restic figures out which files changed, got deleted, or added. Also it does deduplication: if files are moved around, or appear multiple times, they are not added multiple times into the backup. Deduplication is something which Duplicity can't do. But because Restic can do deduplication, there is no common set of files which belong to a single snapshot. Data blobs from one backup can stay in the repository forever, removing snapshots might not remove any files at all.

Restic on the other hand needs "prune" to remove old data. A snapshot can be removed according to the policy specified, but this does not remove the data from the backup directory. A "prune" run will go over the data and remove any block which is no longer needed.

My first question - after figuring out which other backup tool to use: shall I replicate the wrapper script, or try something else? Given that the backup doesn't need complex scheduling, I decided against writing a complex wrapper. And since I am now deploying all devices with Ansible, I decided to integrate this into my Playbooks, and deploy a set of shell scripts. The goal was to have a small number of dedicated scripts doing the daily backup work, and another set of "helper" scripts which I can use to inspect the backup, modify it, or restore something.

My main goals for this: "small number of programs/scripts" (Unix style: each tool does one job), "rapid development" (don't spend weeks writing another scheduler), "rapid deployment" (re-run Playbooks and let Ansible deploy this to all devices).

 

Continue reading "Restic backup"
  • Twitter
  • Bookmark Restic backup at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Restic backup
  • Bloglines Restic backup
  • Technorati Restic backup
  • Fark this: Restic backup
  • Bookmark Restic backup at YahooMyWeb
  • Bookmark Restic backup at Furl.net
  • Bookmark Restic backup at reddit.com
  • Bookmark Restic backup at blinklist.com
  • Bookmark Restic backup at Spurl.net
  • Bookmark Restic backup at Simpy.com
  • Bookmark Restic backup at blogmarks
  • Bookmark Restic backup with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...'

The openHAB rule system is not very helpful by pointing out when it's missing something, or when there is an error to actually point to the problem.

Was debugging an error message for a while and couldn't figure out what is wrong:

Configuration model '....rules' has errors, therefore ignoring it: [152,5]: no viable alternative at input '...'

The line number specified was somewhere else in the file, and had nothing to do with the rule in question. After removing almost everything from the rule, except a logInfo() message, the error still happened - and then it occured to me: I forgot to specify "Item".

My faulty code was:

rule "Rule Name"
when
    Sensor_name received update
then

where it should have been:

rule "Rule Name"
when
    Item Sensor_name received update
then

Error message totally not helpful ...

  • Twitter
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...'
  • Bloglines openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...'
  • Technorati openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...'
  • Fark this: openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...'
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at YahooMyWeb
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at Furl.net
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at reddit.com
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at blinklist.com
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at Spurl.net
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at Simpy.com
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' at blogmarks
  • Bookmark openHAB: Configuration model '....rules' has errors, therefore ignoring it: no viable alternative at input '...' with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

OpenStreetMap: Find benches with missing access tag in JOSM

As reference for me: find benches with missing access tag in JOSM when editing OpenStreetMap:

amenity=bench -access=* inview

 

  • Twitter
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg OpenStreetMap: Find benches with missing access tag in JOSM
  • Bloglines OpenStreetMap: Find benches with missing access tag in JOSM
  • Technorati OpenStreetMap: Find benches with missing access tag in JOSM
  • Fark this: OpenStreetMap: Find benches with missing access tag in JOSM
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at YahooMyWeb
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at Furl.net
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at reddit.com
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at blinklist.com
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at Spurl.net
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at Simpy.com
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM at blogmarks
  • Bookmark OpenStreetMap: Find benches with missing access tag in JOSM with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

OpenStreetMap: Find buildings with missing tags in JOSM

As reference for me: find buildings with missing tags in JOSM when editing OpenStreetMap:

building=* -"roof:colour"
building=* -"roof:shape"

 

  • Twitter
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg OpenStreetMap: Find buildings with missing tags in JOSM
  • Bloglines OpenStreetMap: Find buildings with missing tags in JOSM
  • Technorati OpenStreetMap: Find buildings with missing tags in JOSM
  • Fark this: OpenStreetMap: Find buildings with missing tags in JOSM
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at YahooMyWeb
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at Furl.net
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at reddit.com
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at blinklist.com
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at Spurl.net
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at Simpy.com
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM at blogmarks
  • Bookmark OpenStreetMap: Find buildings with missing tags in JOSM with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Advent of Code 2020: "Seating System" - Day 11

Your career as a hacker brings you more and more unreasonable tasks. Today you arrive at the ferry station, head to your next gate (no one mentioned if you even got an ice cream), and figure out where to seat. Even though you are the first person in the waiting area that does not stop you from knowing the seating habits for all other passengers, and calculate their seating patterns.

Task 1: There are some seats, and some floor tiles. Every seat is empty. Seating follows some rules: 1) if a seat is empty, and no adjacent seat is occupied, someone will absolutely sit there 2) if a seat is currently occupied, but four or more adjacent seats are also occupied, the person will instantly jump up, disconnect all charging devices, and find a new seat 3) no one sits on the floor 4) this will not occupy all seats - which seems to be a good thing in Corona-19 times. Repeat that pattern until the seats do not change between two repeats. Then count the number of occupied seats.

Task 2: Adjacent seats spawn across floor tiles, so it can be a couple steps in each of the 8 possible directions. Looks like people don't like to look at other people here. Oh, and now it's 5 or more seats which must be occupied, before someone jumps up and changes seat. Again repeat the pattern of people getting up and finding new seats all one by one, until everyone is satisfied with their current seats. And then hope no additional passenger arrives!

 

Continue reading "Advent of Code 2020: "Seating System" - Day 11"
  • Twitter
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Advent of Code 2020: "Seating System" - Day 11
  • Bloglines Advent of Code 2020: "Seating System" - Day 11
  • Technorati Advent of Code 2020: "Seating System" - Day 11
  • Fark this: Advent of Code 2020: "Seating System" - Day 11
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at YahooMyWeb
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at Furl.net
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at reddit.com
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at blinklist.com
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at Spurl.net
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at Simpy.com
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 at blogmarks
  • Bookmark Advent of Code 2020: "Seating System" - Day 11 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca