#automation

danie10@squeet.me

The xdotool command on Linux can automate just about any keystroke or mouse actions from the command line, or for shortcut keys

Github title image for the xdotool project page
I’m busy looking into xdotool to automate various actions on Linux with the Elgato Stream Deck (well because Elgato only provides apps for Windows and MacOS). There is a good Linux alternative app to work with the Stream Deck, but I do need to be able to execute some commands when I want to bring a specific window into focus from the background, and then to execute a key press shortcut. So an example may be to bring Brave Beta browser window into focus, then activate tab 3 and do a tab fresh.

Another tip I worked out is instead of struggling to identify which window has which name exactly, you can also right-click on a window’s title bar and choose to rename the window. When I restarted that application, it retained the window name.

So, to bring Brave Beta browser into focus, activate tab 2 (CTRL-2), and then do a fresh (CTRL-R), I can just set this command string to a hot key on the Stream Deck: ‘xdotool search –name ‘Brave-Beta’ windowactivate –sync key ctrl+2 ctrl+r’.

You can still do this sort of thing without having any Stream Deck by just setting the same string to any Linux shortcut on the keyboard.

Xdotool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11’s XTEST extension and other Xlib functions. With xdotool, you can search for windows and move, resize, hide, and modify window properties like the title. If your window manager supports it, you can use xdotool to switch desktops, move windows between desktops, and change the number of desktops.

See https://github.com/jordansissel/xdotool
#Blog, #automation, #linux, #opensource, #technology, #xdotool

danie10@squeet.me

Ultimate Garage Door Control With Home Assistant Automated Management

Bright red garage door with a green hedge to the right
This is an interesting project to get a simple motorised garage door opener to connect with some intelligence via Home Assistant.

One could split this into two phases, with the first being really simple and not interfering with the motorisation itself. The first phase could just use the reed switches to indicate on the Home Assistant dashboard whether the door is fully closed, open, or somewhere in between (i.e., jammed or stopped). You could set easy automation rules too to have a timer running when the door opens, and if it is not closed within say 2 minutes, to send an alert to you. Or if the door opens after dark, send an alert to you. The sky is the limit with the rules you can build into Home Assistant to automate things for you.

Getting fancier on phase one, you could add an ultrasonic detector to look downwards and see if the car is in the garage (shorter distance) or it is out (full distance to the floor). The opening / closing automation could take the car’s presence into account as well.

Phase two would have some interface with the motor. But this can be quite simple too, as even my old 15+ year old DC Blue garage opener, as a manual test button on the board. This is for simulating the remote-control button. Some also have a switch on the wall for this purpose. Either ways, you can use the contacts of this button / switch to make or break the circuit to trigger the opening or closing. So, no need to have some super fancy, expensive door opener to get something like this done.

This is also not the only way to do this project, as Home Assistant has a number of project recipes to work with different devices. So, consider others if this looks a bit complex, or consider my phased approach too, to get yourself tempted for phase two.

See https://tech.scarey.net/ultimate-garage-door-control/
#Blog, #automation, #garagedoor, #homeassistant, #technology

danie10@squeet.me

How I’m using Make (Integromat) to automate my blog posting to 8 different social network profiles

Bild/Foto
As I’ve been testing various alternative social networks over the years, I’ve been picking up more accounts, with different followers, on each one. As at March 2023 I’m posting to 19 profiles daily.

Bild/FotoMakes pulls posts from the WordPress RSS feed, and pushes out to networks

Although I interact and reply directly on every network daily, I have tried as far as possible to automate the blogging creation process for two reasons:
- My own WordPress blog gives permanency (I can back it up, move it {it was on Drupal previously}, etc myself), including backing it up to the Internet Archive. It acts as a single growing repository for searching through my posts (which I use myself to refresh on something I solved before, or something I read about 2+ years ago). Alternative networks do disappear along with all your posts, e.g. on Google Plus I had over 500,000 followers and a mass of posts I did, as did the YouMe social network, MySpace, and others).
- It is also easier to compose once and replicate as far as possible as it takes time to paste titles, tags, images etc to each one.

So I’ve long been looking at replication services, and there are many free services, but usually the free services only allow posting to individual profiles (not groups or pages) or to a limited number of profiles. WordPress has a mass of plugin support, but the same goes really with many only posting to a single social network. One of the better ones I saw there, that would also post to LinkedIn Pages, starts at $12 per month. I don’t have sponsorships or advertising for my blogging, so every cent I pay comes from my own pocket. I do it for fun, not income (is that a pun…).

Furthermore, I also started to realise that many blog to social services are limited to just the popular networks they support. So as Mastodon rolled around, nothing supported it.

I was eventually evaluating between Integromat, IFTTT, and similar. After weighing up costs, I actually found Integromat the cheapest at $5 per month back then, and it also had a lot of flexibility as you could set up your own webhooks and connections manually for something that did not already exist. For popular networks like Twitter, LinkedIn, Tumblr, etc it was just a matter of dropping a connector in, and then linking them, and choosing what fields appear where.

I should also mention that I’ve always tried to base my blogs automation around the blog RSS feed. So in this case Integromat would read my blog’s RSS feed for new posts (as an RSS connector), and then I’d have connectors for Twitter, LinkedIn etc connected, each with the relevant title, description, hashtags, etc fields in the correct formatting. A bonus to this, is being able to also set filters on certain connections eg. my GadgeteerZA Twitter profile is only for technology based posts, so the connector will only push to that account if it recognises the technology tag as present. Similarly, I post only open source related posts to the SAOSS Twitter profile.

Integromat became Make about a year back, and accounts were migrated over. Fortunately, my existing account was grandfathered over still at $5 per month. The point though is the process flow works for me. Even though there is not yet any connector for Mastodon, I was able to configure a webhook using the Mastodon API (not a very easy task and I should do a video about it maybe), but it works very well. Make also has a lot more functionality than I’m using for things such as full programming statements for conditions, text parsing and processing, etc. So yes it can be relatively simple, but some more advanced stuff needs some learning. The point being, though, you have a lot of scope and flexibility.

Bild/FotoFormatting in Make for a Mastodon post

So, for example, the formatting for the Mastodon post (image available in my WordPress blog post) will include a simple title field from the RSS feed, but because the description content may be longer than 280 characters or so, I either include the 280 if it is less, or I append the word “…continued” if it is longer. I test to see if there are WordPress tags, and if so, I prepend a # in front of each.

Make is perfectly usable for zero cost, and it was how I started out using it. I see the first paid tier is now $9 per month.

Disclaimer: I have an affiliate link https://www.make.com/en/register?pc=gadgeteerza that gets you a month free on the Pro plan. I know it is not a long term discount, but if you are going to use it anyway at the normal price, it gives me a $1 per month discount. I’m posting about how I’m using Make as a few have asked why I’m blogging from WordPress to other sites. My choice to use this platform long preceded it even becoming Make, and each person should first evaluate what they want to post to where, and decide on an option that works for them. Make is not going to be for everyone, as many will go for simper options (many free options will work), and businesses have no qualms about paying double the price for plain ease of use.
#Blog, #automation, #blog, #social, #technology, #withMake