Category: *.*

March 8th, 2020 by Chief

This can also be used to verify that Domoticz and Mosquitto MQTT broker are working fine together. Another example is the use of commands like this to update or control virtual sensors or switches on Domoticz from another device like Arduino or ESP. It can be handy if you are making some custom devices that will communicate with Domoticz. Basically, it is a virtual sensor update via MQTT.

Environment that we work on

What we have here is a Domoticz V4.10717 and Mosquitto 1.6.8 x64 installed on the Microsoft Windows server 2016. Why is that important? Well if you have these running on the Linux, commands may be a little different. The principle is the same, but some characters are handled in a different way.

How is this gonna work?

So, we are going to show three examples of Mosquitto commands. One for updating a virtual switch that has only “On” and “Off” options. The second one will be updating a virtual temperature sensor. The third one is an update of the Temperature + Humidity virtual sensor. We will also try to explain what Domoticz expects as input for different sensors, and how to fulfill that with Mosquitto commands.

Updating the virtual switch with MQTT

First, open the command prompt and navigate to a directory where Mosquitto is installed. In my case, it is “C:\Program Files\mosquitto\”. Then go to Domoticz and check the IDX of the virtual switch that you want to update. There are few examples in other Domoticz related articles so if needed you can look there for more info. In this case, IDX of the virtual switch is 3, so here is the command: mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:3,\”nvalue\”:1}” .

Take the command apart

The mosquitto_pub is the app. -h is an option that is used to specify the address of MQTT broker, and since it is the same machine we use “localhost”. -t is an option to specify the topic and we use default “domoticz/in”. Finally -m is an option to specify the MQTT message.

Something about MQTT message

Let us peek into what we are sending as a message. “{ \”idx\”:3,\”nvalue\”:1}” For easier understanding here is what Domoticz expects: Topic: domoticz/in, Message: { “idx”:3,”nvalue”:1} . To say it short whatever part is between “” it is a string data type. If something is not between double quotes, it means that it is an int data type. Let`s go back to message that we are sending “{ \”idx\”:3,\”nvalue\”:1}”. there is a backslash before every double quote. In essence, we need to use special character ” as a regular one, so we prepend it with a backslash like this \” That is called escaping a character. I hope it is a little easier to understand this command now. Here are screenshots of sensor status and command execution together. It is obvious that if we send 1 as nvalue virtual switch goes to On status and with 0 it goes to Off.

Virtual switch update with MQTT.
mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:3,\”nvalue\”:1}”
Virtual switch update with MQTT.
mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:3,\”nvalue\”:0}”

Updating the virtual temperature sensor with MQTT

We will start with the command. mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:1,\”nvalue\”:0,\”svalue\”:\”18.4\”} One thing different now is svalue since it is expected to be sent as a string comparing to nvalue that is an integer. What I`m talking about is that 0 is without double quotes and 18.4 is between them. Let us see how the sensor and commands look like.

Virtual sensor update with MQTT.
mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:1,\”nvalue\”:0,\”svalue\”:\”18.4\”}

Updating the virtual temperature + humidity sensor with MQTT

The command: mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:2,\”nvalue\”:0,\”svalue\”:\”1.2 ; 33 ; 1\”} . Now everything in svlaue is a string that looks like value than space than ; than space than value than space than ; than space and 1 at the end. That is how Domoticz expects iput for this sensor. To be honest, I do not know why is there a third value (1) here, I can only assume that it could be for the battery level or something like that. To summarize important things here 1.2 is the temperature, and 33 is the humidity percentage. Let`s see this one`s screenshot.

Virtual sensor update with MQTT.
mosquitto_pub -h localhost -t “domoticz/in” -m “{ \”idx\”:2,\”nvalue\”:0,\”svalue\”:\”1.2 ; 33 ; 1\”}

That`s all, folks. Now you can manipulate virtual sensors manually or as we said before, perform virtual sensor update via MQTT. Thank you for reading.


Posted in *.* Tagged with: , ,

Domoticz and Mosquitto on Windows
March 1st, 2020 by Chief

This guide is about how to set up a functional Domoticz environment on Windows. Moreover, it is Domoticz and Mosquitto on Windows. As I figured out most of the Domoticz instances are running on Linux-es\Raspberry-es. In contrast, I just want to show how to do it this way. Since I already have a PC running 24/7 and believe it or not I like Windows, it was a logical choice.

Few practical advice’s

Windows Firewall

I know that it is not a best practice, but before you begin I would suggest that you turn off windows firewall for good (just temporary all networks). Finally, when everything is up and running you can turn it back on and configure it to allow ports needed for these apps to work. We will mention that again later.

Microsoft Visual c++ redistributable

Another thing is Microsoft Visual c++ redistributables. If you ask me, download them all from 2013 to the latest version in both x86 and x64 versions and install them from the oldest to the newest one by one. It may sound stupid, but it is not taking much space and many apps rely upon those redistributables. Domoticz is one of them! Finally, if it is hard to find all of them just write a comment for this article, I do have one archive to rule them all and I can send it to you. 🙂

Install Domoticz on Windows

First of all, download the installation from here. Setup is as easy as it can be so there is almost nothing to explain. Just run it and click next. The only thing that I can suggest is that you chose to run Domoticz as a service as it is the right thing to do. Explaining why is not part of this article but let’s just say that due to its nature and purpose Domoticz should be running all the time, 24/7.

Port numbers

In case you are ok with default port numbers (and there are not many reasons not to be) just leave them be and finish the installation. Hence, everything went fine fastest way to check is it working is to open the browser on the same computer where you just installed Domoticz and open this address: http://localhost:8080. You should get something like this.

Service Status

In case nothing opens or page is not available most probably Domoticz service is not running. Consequently, you need to figure out what is happening. Type services in Windows search and open it. Find Domoticz service and check it`s status. The service should be running.

The service status should look like this. If service is not running try to start it. In case service starting ends with failed, or pause or stoped, there is a problem. Most likely you did not turn off a firewall or did not install those Microsoft Visual c++ redistributables that I mentioned before. It is now wise to visit Windows Event viewer and check Windows application logs for errors or warnings regarding Domoticz service. Now, let`s continue with Mosquitto installation.

Posted in *.*, Home Automation Tagged with: , , , ,

Mounted sensor
February 24th, 2020 by Chief

The wireless magnetic switch is great for home automation in many ways. For example, knowing when a certain door is open, or maybe turning on the light if door or windows is opened. Another great thing is security features that it can provide, but maybe the coolest use case is installing one on the mailbox so you know when the mailman opens it, and you can get Telegram message, “Post arrived”.

What wireless magnetic switch to chose ?

There is one important thing to look for if the sensor is used with Domoticz since there are devices that send the same code whenever state changes (opened or closed). There are also devices that are sending “A” code when closed, and code “B” when opened. That is better since you do not need to track the state based on the assumption of the previous state. This model is one that sends two codes and works with Sonoff RF Bridge. It looks nice, comes with double-sided adhesive tape pre-cut for both sensor and the magnet, and preinstalled industrial-grade AAA battery. You just need to mount it and remove the battery protective sticker so it gets power from the battery.

Wireless magnetic switch package
Magnetic sensor / switch package
Wireless magnetic switch package
Magnetic sensor / switch package

Switch montage

I would suggest that if the possible switch is mounted on the non-moving side and the magnet on the moving side. It means that the magnet (smaller part) should be mounted on the door and switch to the door frame. The reason is simply the avoidance of interference that can occur if the transmitter is moving during transmission.

Wireless magnetic switch mounted
Example of montage to avoid transmitter being on the moving side.

Add door switch to Domoticz

The process is similar to adding a 433 MHz smoke detector. We go to Setup – Hardware and Create Virtual Sensors. Then comes the naming of the sensor. And do not forget to chose “Switch” as a Sensor Type.

 Wireless magnetic switch - Virtual representation

After this, edit switch and select Door Contact as a switch type.

Wireless magnetic switch - Virtual representation type

It is now time to link a real-world sensor (hardware) with its digital twin. Go to Setup – More options – Events and prepare to copy the codes that switch transmits. Separate magnet from the switch and it should transmit a signal. In Setup – Log you should see something like this:”2020-02-17 19:14:38.519 MQTT: Topic: domoticz/in, Message: {“idx”:xyz,”nvalue”:0,”svalue”:”9xxxxxx”,”Battery”:100,”RSSI”:5}”

Copy the svalue code to a Notepad or something like that, you will need it soon. Repeat the process for the other code as well. You need both codes.

That is how Blockly looks like. Just put your code values and you are ready to go. And of course, you can configure it to notify you when the switch is triggered. Details regarding configuring this are in the “Smoke detector” article.

Thanks to Dr_ Kosh here is the same thing for DzVents….

return {
	on = {
		devices = {
			yy --yy is idx of your rf bridge
	execute = function(domoticz, device)
	    local doorSwitch = domoticz.devices(xx)  --xx is idx of your virtual switch
	   	if(device.state == 'OnCode') then --Change OnCode with your actual code
			if(device.state == 'OffCode') then  --Change OffCode with your actual code

This may come in handy if you have multiple door switches, so just expand the code following the same logic.

One more tip…

Just to mention, if for some reason there is not enough space for the smaller magnetic box of the switch, you can use almost any magnet. The first picture shows switch mounted on my door and space was to thin for the original magnet. So I used a magnet from the hard drive since it’s very small and strong and it does the same job.

If you find this article interesting there is more in the Home Automation category. Once more, thank you for reading, and if you have any questions regarding the subject, just post a comment. 


Posted in *.*, Home Automation

433 MHz smoke detector compatible with Domoticz
February 8th, 2020 by Chief

It`s extremely important to have a piece of critical information, right on time. So, it`s great to have an option to be remotely alerted in case of fire or smoke at your house. I`m thinking Telegram… E-mail… and … Domoticz in combination with C50W 433 MHz smoke detector.

So, this article is about choosing and adding a wireless smoke detector to Domoticz. In this example, we used C50W 433 MHz wireless device. No, it does not mean Wi-Fi, but wireless 🙂 There can be a big difference since Wi-Fi is wireless, and wireless does not necessarily mean that it is Wi-Fi.

Wi-Fi vs Wireless

Wi-Fi is a family of wireless networking technologies, based on the IEEE 802.11 standards. In general, it is intended for use in short-range networking of computers, smartphones, and other devices. On the other hand, wireless means that the device can transmit and/or receive something without cables (wires). For example, a walkie talkie is wireless but not Wi-Fi. Then there is a wireless charger. Not to forget our 433 MHz smoke detector that is wireless, and not Wi-Fi. The main reason is the much lower energy consumption. You definitely do not want to change the battery in your smoke detector on a weekly routine.

Back to original theme, adding sensor to Domoticz

First of all, for this to work you need some kind of 433 MHz RF Bridge already setup and working with Domoticz. I Use SONOFF RF Bridge, flashed with Tasmota firmware. RF bridge is both transmitter and receiver on 433 MHz but also has Wi-Fi connectivity, so it talks with Domoticz over Wi-Fi. This Sonoff device is great, and yet under 10 $. After that, you obviously need a 433 MHz smoke detector. I`m using these ones. It is marked as C50W and it costs around 10$. A short piece of advice, there are many devices out there marked as 433 MHz. And manufacturers are not lying about it. The trick is that they use some proprietary or nonstandard protocols, which means they may or may not work with third-party devices. You will need to do some research before buying it.

Configuration of C50W

This pretty little thing comes with a terrible, unusable manual. It also comes without the battery so prepare a quality one. Do not even try to test or use it with a used 9V battery. When the time comes to change the battery it will start beeping at 45 seconds interval and note: it will not give you an audible alarm or send any signal on RF. There are also four jumper places with two jumpers placed in the middle. Their intent is to change electrical resistance and the code it sends over the radio. If you ask me how to place those jumpers I would say that I do not know. Just leave them be for the start. There is a little hole for adjusting sensitivity to smoke, and that also has a great range. You can play with it to adjust it to your needs if you want.

C50W smoke detector

Add C50W to Domoticz

First of all accept “virtual sensor” as a term, since most things you add to Domoticz are represented by VS. If it`s easier observe it as a virtual representation of physical sensor, or its digital twin. Since this kind of device has a normal state, where nothing happens, and an active state where the alarm is triggered, the default state is normal. This means that the state will change only if it detects smoke. So we kind of have a two-state thing, and it may remind us of a ….. switch? True! So let us start with a virtual s… .

Add virtual sensor as digital representation of  C50W

Next chose a Switch as a sensor type, and name it as you wish.

Wirtual switch representing C50W

After that find your switch under switches tab and click on edit.

Edit virtual switch

The whole new world of switches opens up there. We are aiming for the smoke detector.

Virtual switches in Domoticz
And do not forget to save your setting, since I make that mistake almost every time.

Connecting physical and virtual worlds or joining the digital twin to its physical brother

Let`s summarize what we did and what needs to be done. We created a virtual switch that serves as a representation of the real one. What is missing now? A link between them. We mentioned before that C50W sends some kind of code on 433 MHz when activated. What is needed is to intercept that code, and link it to changing state of a virtual switch.

What is going on with RF Bridge

Quick reminder of how RF bridge works. Whenever it detects 433 MHz signal or if you like it more, commands, it reports it to Domoticz via MQTT. It means that you can find that exact code in Domoticz log file, and it looks something like this.

Domoticsz log file capturing command from C50W sensor
Log file in moment of triggering C50W

So this is the code that my C50W will send if activated. Just to mention, you do not need to set fire to discover the code. The big round thing in the middle of the sensor is a test button. When pressed for a few seconds it will simulate triggered alarm and you will get your code transmitted 🙂 .

Time for some blockly work

Now we go to Setup – More options and Events and create a new Blockly script.

Blockly script that will connect  C50W with its digital twin
Blockly script for C50W
Blockly script for C50W

I do not think that this needs much explanation. In short, if the RF bridge detects the value of “x” then set the state of a Smoke detector switch to On. X is a value that you read in your log file. And that is it, ready for testing.

Pressed the test button on C50W and voila…

Digital twin of C50W
Digital twin of C50W

Now the real power comes in. We go to notifications on switch widget and set some alerts.

Configuring alerts on virtual switch

I prefer these two types of alerts. Since this is a critical sensor, Telegram is the first choice as it is delivered instantaneously, and email….. email is just in case. Of course for these to work you must configure them in Domoticz settings, but it is not a big deal. Now if god forbid there is smoke in your house, Domoticz will message you.

If you find this article interesting maybe you should check on this one regarding building a sensors station for Domoticz. Thank you for reading, and if you have any questions, just post a comment.


P.S. I wanted to put the picture of a detector on the ceiling, but it kind of looks stupid. If angle is wide enough to get real impression that it is actually detector on the ceiling than it looks like a little spot, almost undetectable. If it is close enough to have a descent look at the detector than it looks same like on the table 🙂

Posted in *.*, Home Automation Tagged with: , , ,

Tasmota ESP8266 Sensor station
February 3rd, 2020 by Chief

How does monitoring Temperature, Humidity, Pressure,  Illuminance, and Air quality sounds like? Well, it sounds great especially if we can do it in under 50 US $ budget, and it even has some basic weather prediction functions, when combined with Tasmota and Domoticz.

Why measure air quality?

We had a situation in the city where people started to get sick with respiratory problems at the mass level and it was obvious that a major problem is the quality of the air. I mean it was noticeable with the bare eyes and nouse but authorities kept saying that air is ok, and they were publishing fake results. Moreover, results were in the form of a statement like “Air quality is at a satisfactory level”. Yes, it is ok if you ar an internal combustion engine with a great air intake filter!

How could air become so bad in a city without industry?

This started happening with the beginning of a heating season, and it was just a coincidence that the city got a brand new heating plant. Well, later we find out that it was not exactly in city ownership. Moreover it is a privately owned and operated, with a nice and lucrative contract. In fact, the new plant is so nice that they shut down former plant (with chimneys like two times higher than those at the new plant) that was owned by the city and the only heating option left is this new monster that uses wood as a fuel. I could write a completely new story on this subject, but I will stop here.

Why Nova SDS011 PM sensor?

I came to learn about it from the necessity. I wanted to see what is going on with the air pollution and I found a bunch of sensors there on the market but did not know where to start. In fact, one independent journalist brought few “Purple Air” sensors and installed them around the city, and the results were catastrophic. For example, they measured 300 – 500 (US EPA PM2.5 AQI ) almost all the time for 2 months. On the other hand, 0 – 50 is ok on their scale and that scale ends with 500.

These purple air sensors cost around 250 US $ so they are not so cheap. On the other hand, you just have to put it on a good spot, connect it to Wi-Fi and power. But it is very enjoyable to build something yourself so, DIY again 🙂 . Just one more comment, authorities said that these “so-called” measuring devices like “Purple Air” sensors are not calibrated, and not attested by their accredited agency so the results were wrong. As soon as they started talking things like that, the air became so pure and enjoyable to breathe that everyone was so shocked and happy to have the opportunity to live under so wise rule.

Joost Wesseling (RIVM) – Air quality measurements using cheap sensors

What convinced me even more that I`m on the right track was Mr. Joost Wesseling from The Netherlands National Institute for Public Health and the Environment, keynote at the Things conference in Amsterdam. If you read this article until now, it means you are interested and I warmly suggest you watch this 25-minute video .

Back to technical stuff…

First, we will make a little bom (bill of materials) containing major parts. After all, we are building a quite complex device. Therefore we must know what parts do we need.

PartPrice US $
1. ESP8266 development board2.8
2. Nova PM sensor SDS011 High precision laser pm2.5 air quality detection sensor module 18
3. BME280 temp hum baro sensor 3V3
4. BH1750 light intensity illumination module 3V2.5
5. 5V 2A power supply3
6. Some wires, cables, connectors, screws, cable ties and a box…10

Regarding tools needed for the job, I used: soldering iron, hot glue gun, small drill, angle grinder, few screwdrivers, cutting pliers, multimeter, smartphone and a computer.

Since I had to order some parts from China, there was not much to do until they came. I was killing some time wondering how to assemble everything together. What will I use as housing? I went through some stuff I had and noticed the old HP Inkjet printer power supply. I opened it and after measuring the size, it looked like everything could fit in nicely. And it did, so this power supply casing was a box for my sensors device.

Nova SDS011 PM sensor
Nova SDS011 PM sensor fitted in the box

First I put everything together to see how it works. I had a doubt regarding connecting two i2c sensors in parallel (doubt was about addressing not about can it work or not). BME280 and BH1750 are both connected to scl and sda pins of ESP, and I did not now will Tasmota firmware be able to discover them both without fine tuning. But it worked like the charm from the start.

Wiring diagram of the Tasmota and Domoticz sensor station with SDS011 air quallity sensor.

Wiring diagram

Wiring diagram
Wiring diagram as simple as it can be

Regarding wiring, SDS011 talks on serial, so RX goes to ESP TX and TX goes to ESP RX. +5 Volt from SDS goes to Vin on ESP with the assumption that you will connect that pin later to the power supply of 5V DC. This sensor working voltage is 4.7 – 5.3 V, so do not connect it to 3 V pin, it is to low and it may affect readings. As always ground goes to ground. BME280 and BH1750 use the I2C bus, so their SCL (Serial Clock) together goes to ESP SCL which is on pin D1, and SDA of both sensors goes to D2 on ESP since it is Serial Data pin. Sensors VCC connects to a 3V pin on ESP. We already know about ground :).

Handling SDS011 while working

Just to mention that it is not a bad idea to cover air inlet and outlet of a sensor while you work around it, especially drilling or grinding, to prevent dirt to pollute sensor. When all rough work is done, remove the covers. Better safe than sorry.

Covered air in and outs of a sensor.

How it fitted together

Since the goal was to make it nonexpensive, and yet durable and to finish it fast, this is what I did regarding assembly. I positioned the Nova SDS011 sensor on one side of the box, put a microcontroller next to it and then made some physical barrier to create a compartment for BME280. The reason I wanted it separated was the intention to remove it from any heat dissipation that the ESP8266 board produces no matter how small it is. That way alteration of the temperature reading would be minimized.

Positioning components inside the box

I made a socket for the ESP development board on the prototype PCB, so it can be removed, or replaced easily without any soldering. After all this sensors unit is a prototype. The micro USB connector on the board is accessible when the box is open in case it is needed. There are markings on board so there will not be the accidental wrong insertion of ESP board.

Socket for ESP development board.
Some in image explanations regarding Tasmota  sensor station with SDS011 air quallity sensor.
Some in image explanations

Installation for test measurements

Tasmota and Domoticz sensor station with SDS011 air quallity sensor.
Sensors device installed just near the roof
Tasmota and Domoticz sensor station with SDS011 air quallity sensor.
Place where I installed device on the house

Well, I had the opportunity to dig in some cables since there is still no facade on the house, and I put a few UTP cables in. I used one for PoE camera, other for sensors device power supply, and since this is the IoT time, I left two more cables to wait for it 🙂 . First, I chose this location thinking, that it is high enough from the ground to prevent dust and some other near ground particles to contaminate sensor readings. Second, it is far enough from the roof to have its heat dissipation mess with the temperature readings. Third, it is enough protected from the rain and both air openings are from the bottom so it should be impossible for rain to get into the device or sensors.


Everything built here is a piece of junk without the software.

Tasmota had been flashed on to the ESP. Tasmota will be sending data from sensors to Domoticz. I will not enter into many explanations here, you can find needed information at those two links. I also uploaded flasher and two needed .bin`s here. Firmware is 7.2.0, and it will be obsolete very soon. I put it for those of you that like shortcuts 🙂 . It will do the job, and later you can upgrade.

Flashing ESP with Tasmota firmware

There are literally tons of information regarding the process out there, but I will put it in very short terms again here. 1. Connect ESP to your computer, figure out what com port is it using and configure Tasmota flasher accordingly. 2. Press taster for entering flashing mode and then press the reset taster on the ESP dev. board. 3. Release the reset taster, and then release the first taster on ESP. 4. Select the tasmota-sensors.bin in flasher and then send it to the device. (tasmota-minimal.bin is needed only if you are doing OTA (over the air) upgrade).

Configure module pins with sensors.

We now need to tell Tasmota, what sensor is connected to which pin on the ESP board. I attached the screenshot of the config and when compared with Wiring diagram it is self-explanatory.

Configure Tasmota module
Configure module for connected sensors

Results from Tasmota and Domoticz

When flashed and configured, here is how Tasmota web interface looks like. You just find its IP address on your dhcp server (it will be showed as sonoff-acb or tasmota-xyz or something like that) and enter that IP address in your browser. It is nice to make a reservation (or static assignment) on dhcp so address stays the same. On that interface you can basically read values from the sensors and configure, backup or upgrade Tasmota.

Tasmota ESP8266 Sensor station
Tasmota ESP8266 Sensor station

This is how the results from Domoticz look like.

But it is not just about reading values that came just now, logging gives the real power…

So, from the PM 2.5 monthly shows some real air quality statistics although my sensors unit is still not operational for a full month. One more thing to remember, this shows pollution in PM2.5 μg/m3 (raw) and the usual standard is US EPA PM2.5 AQI. That means if you are going to compare it to “Purple Air” you need to convert, or at change units displayed on Purple air (it is on the map). Anyway these raw readings converted to AQI are much higher, so you know what to expect.


I wrote this with a simple intention. That is to show how easy to build and inexpensive this kind of sensors unit can be. I hope it serves as a warning and a manual.

If you find this article interesting maybe you should check on this one regarding fixing a “weather unknown” message. Once again, thank you for reading, and if you have any questions or need help, just post a comment. I’ll get in touch with you asap.


Posted in *.*, DIY, Home Automation, Micro controllers Tagged with: , , , , ,

February 3rd, 2020 by Chief

Wondering how to add an SDS011 air quality sensor with Tasmota to Domoticz? Here is a step by step guide how to do it.

First, we need to start with the Tasmota configuration. In addition, let`s just assume that we have a hardware sensor like this built. Above all, now we need to configure it.

Flashing ESP8266 with Tasmota Firmware

It is easy so I`l make it as short as possible…

Here are a flasher and 7.2 version bin if you want to start right now. 1. Connect ESP to your computer, figure out what com port is it using and configure Tasmota flasher accordingly. 2. Press taster for entering flashing mode and then press the reset taster on the ESP dev. board. 3. Release the reset taster, and then release the first taster on ESP. 4. Select the tasmota-sensors.bin in flasher and then send it to the device.

Wi-Fi configuration

Further, after flashing just do a regular reset and you are ready for initial configuration. Therefore you need to connect to Tasmota via WiFi as it now acts as a hotspot. For instance, you could use your smartphone to scan for available WiFi networks and you should see one with “tasmota” in a name. Connect to it and it will show you “sign in” message. Click on sign in and it will open Tasmota configuration site. Here are screenshots in a gallery.

When flashed and configured, here is how Tasmota web interface looks like. Just find its IP address on your DHCP server (it will be shown as tasmota-ACB or something like that) and enter that IP address in your browser. It is nice to make a reservation (or static assignment) on DHCP so the address stays the same. On that interface, you can basically read values from the sensors and configure, backup or upgrade Tasmota.

Configure Tasmota Module for the sensors

This should be easy. SDS011 is connected to the Rx and Tx ports of the ESP board. Above all, remember that Rx and Tx need to be crossed (Rx goes to Tx, and Tx goes to Rx). Imagine it like talking. When You talk (Tx)then I Listen (Rx), and vice versa. We are talking about wire connections right now. Now we move to a logical connection. For TX (GPIO1 serial Out) chose from the drop-down menu SDSx1 Tx(101), for the (RX GPIO3 Serial In) chose SDS0x1 Rx (70). In this example, I connected more sensors. It means more pins need configuration. For more info about wiring go to this article.

Configure Tasmota module with pins of SDS011 and other sensors.
Configure module for connected sensors

Configure Tasmota to send data to Domoticz

First of all, Tasmota is not gonna talk directly to Domotics. Therefore you need to have an MQTT broker up and running. Moreover, in most cases, it is a Mosquito and it is installed on the same machine as Domoticz. Under this assumption, we will continue configuring Tasmota. On the MQTT menu, you only need to edit the first field named Host(). There you enter the IP address of your MQTT broker. If it is installed on the same machine as Domoticz than IP address is the same. If you left everything on default values during Mosquito and Domoticz setup, no need to do anything else here.

Configure MQTT for data from SDS011 and other sensors to be sent.
Configure MQTT

Configure Tasmota and Domoticz in pairs

This part can be a little tricky if you do not know how MQTT, and Domoticz work, but I will try to make it clear and in pairs, so it is easier to understand it. First, we will deal with SDS011. Since it has readings of PM 2.5 and PM 10 we will need to create two virtual sensors. Moreover, since the process is the same only one will be shown here. You go to Domoticz website- Setup menu in the top right corner then hardware, and after that chose “Create virtual sensor”.

Domoticz - Add virtual sensor that will  display SDS011 PM 2.5 data.
Domoticz – Add virtual sensor

Then you name it PM 2.5 since it will be for that sensor data, chose “Custom sensor” from the drop-down menu, and add “μg/m3” as axis label as these are the units that sensor actually measures.

Add custom sensor Domoticz for displaying air polution data from SDS011
Add custom virtual sensor Domoticz

This virtual sensor is gonna display data from the SDS011 physical sensor. Meanwhile, next thing to do in Domoticz is to go to Setup/Devices and check the “idx” of the newly created sensor. You can find it at the end of the list or by searching for its name.

Check the idx of newly created virtual sensor that will display SDS011 PM 2.5 data.
Check the idx of newly created sensor

It`s time to follow this setting in the Tasmota Domoticz menu. Idea is to configure tasmota`s predefined value (in this case Sensor idx 7 Voltage/PM2.5 with idx of the newly created virtual sensor named “PM 2.5” in Domoticz. So we enter the value of 192 to that place.

Configure Tasmota for Domoticz

Configure Domoticz setting in Tasmota for SDS011 and other sensor to be sent accordingly.
Configure domoticz setting in Tasmota

Further, I will explain the creating and mapping of a Temp+Hum+Baro virtual switch. Proces is the same, create virtual switch but this time chose like this:

Temperature Humidity Barometer VS
Temperature Humidity Barometer VS

Again check the idx of the virtual sensor on Setup/Devices menu

Temp hum baro idx
Temp hum baro idx

After that, we go back to the Tasmota page and into Domoticz menu and this time set the value of the ” Sensor idx 3 Temp,Hum,Baro” to 148. This has to be repeated for every sensor added, on both sides!

How it looks in Domoticz

If you find this article interesting maybe you should check on this one also. Once more, thank you for reading, and if you have any questions or need help, just post a comment. I’ll get in touch with you asap.


Posted in *.*, DIY, Home Automation, Micro controllers, Tech Tavern Tagged with: , , , ,

Temp + Hum + Baro virtual sensor
January 26th, 2020 by Chief

This is a Temp+Hum+Baro virtual sensor in Domoticz, or to clarify it is its graphical representation. It sure looks nice but there is one very annoying thing going on here and that would be “Prediction: Unknown”. Later we will deal with this problem after we explain our setup and what is going on in the background.


In this case, I have Domoticz running on my Windows 10 PC with (yes it is not on Raspberry Pi, can you imagine 🙂 ) I have PC running all the time anyway so that is the main reason for Domoticz on PC and regarding that subject, we will stop right now. On the other side is ESP8266 with the Tasmota firmware and Bosch BME280 sensor. For easier understanding we will call ESP and BME together “physical sensor”, and another side that represents and logs data on Domoticz will be called “virtual sensor”.

This “Prediction: Unknown” message is not a big deal, but since the rest of the sensor looks so nice it is a shame not to get it in a perfect state. Therefore, I started with the assumption (and we all know that assumption is the mother of all fuckups) that physical sensor is just feeding the virtual sensor and Domoticz with data and that “Weather prediction” is done on Domoticz by applying some kind of algorithm to gathered pressure data. WRONG!

How it really works

I looked into the DeviceStatus table of the Domoticz DB and under sValue for my device, I found data like this: 3.2;66.3;1;1019.5;5. There are five values in sValue: 3.2 was the temperature at the moment, 66.3 was the humidity, 1 was for “Feels like” , 1019.5 was for pressure, and 5 was value for “Weather forecast”. I Googled a little bit and here is what I found regarding Forecast mapping in Domotiz.

0 – Stable
1 – Clear/Sunny
2 – Cloudy/Rain
3 – Not stable
4 – Thunderstorm
5 – Unknown

“Unknown” explained my problem, but beware, this is not correct mapping. On the other hand, this is the correct one:

0 – No Info
1 – Sunny
2 – Partly Cloudy
3 – Cloudy
4 – Rain
5 – Unknown

Therefore, take care as there is lot of semi truth out there….

As a result, it was logical to see what kind of data is Tasmota sending to Domoticsz so I looked into a Domoticz log, and this was coming: MQTT: Topic: domoticz/in, Message: {“idx”:148,”nvalue”:0,”svalue”:”3.2;66.3;1;1019.5;5″,”Battery”:100,”RSSI”:5} So it matched values in DB, that was concluded, weather forecast data should come from the source. And Tasmota was sending 5, and 5 means unknown. But what to do now?


This matter made me stuck for a few days in a discussion with my colleagues. We were trying to figure out possible solutions. A friend sent me the link to a Domoticz forum where guys published Script To Parse WeatherUnderground Multi-Value Sensor, and that was our base. The script can be found at this address along with some other interesting thoughts.

After that we created device lua script with this code:

  -- + lua / device script
local sensorx = 'ESP Outside' --name of the sensor that  has a problem with weather prediction (Temp+Hum+Baro virtual sensor), you put your sensor name
commandArray = {}

if (devicechanged[sensorx]) then
        WeatherTemp, WeatherHumidity, HumFeelsLike, WeatherPressure, WeatherPressureForecast = otherdevices_svalues[sensorx]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
       WeatherTemp = tonumber(WeatherTemp)
      WeatherHumidity = tonumber(WeatherHumidity)
       HumFeelsLike = tonumber(HumFeelsLike)
        WeatherPressure = tonumber(WeatherPressure) -- hPa
       WeatherPressureForecast = tonumber(WeatherPressureForecast)
         if (WeatherPressure == 0) then
             WeatherPressureForecast = 0
                        elseif (WeatherPressure > 1030) then
          WeatherPressureForecast = 1
        elseif ((WeatherPressure > 1010) and (WeatherPressure <= 1030)) then
        WeatherPressureForecast = 2
      elseif ((WeatherPressure > 990) and (WeatherPressure <= 1010)) then
       WeatherPressureForecast = 3
     elseif ((WeatherPressure > 970) and (WeatherPressure <= 990)) then
     WeatherPressureForecast = 4

0 - No Info
1 - Sunny
2 - Partly Cloudy
3 - Cloudy
4 - Rain
5 - Unknown
 commandArray['UpdateDevice'] = '148|0|' .. WeatherTemp ..';'.. WeatherHumidity ..';'.. HumFeelsLike ..';' .. WeatherPressure.. ';'.. WeatherPressureForecast
 -- 148 is the idx of a virtual sensor that is going to be fixed, in this case it is the idx of the "ESP Outside" virtual sensor. You put your idx number

return commandArray

Comments are already in the code, therefore you should not have any problems adjusting it for your sensors and environment. Above all, do not create Lua / All (commented) script, but Lua/Device script. It may work anyway but as a result, you will have an error in Domoticz log file. I hope this will save you some time 🙂 . The script was up and running after this. I peeked in DB to see, what is going on, and there was “3” smiling out on me from the end of the sValue data. 🙂

ESP8266 + BME280 + Tasmota received data in Domoticz DB

What the script does

We dealt with this problem this way. It can be dealt with in many other ways. The script basically reads all the values from the virtual sensor. Then it puts them in variables. After that, it does some math (comparing may be a more modest word) with pressure and as a result updates, four values of the virtual sensor with the same values and the fifth data field is updated with the number that is calculated based on the pressure. I borrowed that calculation from this article: Article is great, therefore if you like this stuff I recommend it for reading. The script runs every time the virtual sensor gets an update from the Tasmota, and in my case, it is every 5 minutes, in other words, it is not putting any heavy load on the hardware.

I`m not gonna enter into weather prediction algorithm, that is not a subject of this article. This is not a commercial weather station or piece of scientific equipment, it is a homemade system and should be treated like that. On the other hand it should work at least like it supposed to. That was the point.


Domoticz virtual sensor

So if you liked this article may be the one about micro-controllers would be also an interesting one, so if you have some time take a look here. And in the end, thank dr_Kosh for the great contribution regarding this problem.

Once again, thank you for reading,


Posted in *.*, Home Automation Tagged with: , , , ,

October 2nd, 2019 by Chief

If you have experienced problems with Google Home playing content from Spotify, you may find this article very useful.

The problem may manifest itself like your Google Home device not playing anything when you ask it to play music from Spotify, or even worse start and stop playing without any explainable reason. Maybe it is not even a problem and you just need to change its account linked to your Google Home. It may look impossible to find all the options and therefore we wrote you a guide to help.

In most normal cases for adding or removing Spotify as a music service on your Google Home ap you would do the following:

  1. Open the Google Home app on your phone and select the account icon.
Google Home

2. Open the Settings menu.

Google Home – Settings

3. Open the Music menu.

Now you have a list of music services in your Google Home.

Google Home – Music services

It is now clearly visible that there is no Spotify service available

This can happen because you live in or travel to countries where Spotify is not available. For example, a lucky relative that lives in a civilized country ( 🙂 ) shares a family account with you. Of course, you would want to enjoy Spotify no matter what, therefore we go to the other steps needed to achieve that goal.

Google assistant account on a computer. You do this by logging on to any Google service like Gmail or whatever and then in the same browser window just paste this URL: Or just open URL and login, whatever works. It should look like this:

Find Spotify in Google Assistant
Google Assitant

Then you enter Spotify in a search, and you will get its options. It should look something like the picture below.

Spotify in Google Home
Spotify on Google Home

Click on its icon and there it is. Option to unlink an account.

Spotify in Google Home
Spotify linked to Google home

So, this part is for you if you want to change/unlink the Spotify account to your Google Home. Another part involves enabling it to actually work like it should on your Google Home device. So when you finished all the steps above, here is another round.

Disabling Google services to access Spotify

Do this by going to


Then again open your Google Home app on your phone and chose no default provider under music settings if it is not already selected.

VPN to a Spotify available country

The next step is to reboot your phone. Most importantly, do not skip it, because the next step is not gonna work. If you do not have any VPN service installed, get one before the reboot. After the reboot, use a VPN service to connect to one of the countries where Spotify is available. I used FreeVPN and connected to the USA. If you for some reason want to VPN to country other than the USA, you need to check two things:

  1. List of countries where S. is available. You can check it on this URL:
  2. List of countries that your VPN provider supports.

The country of your choosing has to bee on both lists.

Free VPN

Choose default music provider

After connecting to VPN service open Google Home again, and go again to the settings, music. As a result, you get an option to select it or Pandora, or Deezer as a default music provider. It will ask for credentials for your account and permission to link it.

Google Home and Spotify
Add Spotify to Google Home

Besides the fact that the beer is in order, the final step is to reboot your Google Home device. Just unplug it from the power and wait a few seconds before plugging it again. That should do the job, and as a result, your Google Home will now play music from the desired music provider without problems or interruptions. And in the end, thank dr Kosh for great contribution to solving this problem.

Thank you for reading,


Posted in *.*

December 31st, 2017 by Chief

What is web hosting?

It is a service in which hosting provider offers IT infrastructure and on top of its web services for rent.
Usually, it is some sort of web server that provides services needed so that web documents can be accessed, viewed and in some cases edited by web browsers. Simplified, when you enter the web address in your browser or click a search result in your favorite search engine, it is a link to the website. Service called DNS than translates that name to IP address and that is how your device (computer, smartphone or any other web-capable machine) knows where to go. What waits at the end is a web server.

How much does it cost?

It cost anywhere from 0 to hundreds of $, or even more, depending on what kind of service do you want. Don’t get scared, if you need just a regular website for a project, small company or personal blog it is just a few bucks per month. There are even “free” options, but you will get commercials on it since there is no such a thing as a free lunch.

What to look for, and how to avoid being cheated.

This is very important,

so pay close attention to the following. There are many traps that hosting providers use to catch new customers. When you purchase web hosting and build your site or even worse,  sites, it can be a real pain in the ass to change hosting provider. They all make it sound so easy, and even offer so-called “migrating” tools designed for migrations from other providers to your new shiny and best, most reliable and cheapest provider.

There is no such thing as unlimited hosting!

They made it sound so great – Unlimited. No limitations for traffic, databases, websites, domains……… no boundaries at all. When you think of it that way, you could host service like Facebook on that kind of hosting, right? Wrong. The thing is that they moved limitations from the main description of service to the “terms of use”. There you will find some shady info about what “unlimited” really means. Here is the example fro iPage hosting.

Hosting unlimited
Unlimited hosting

Let`s dig a little deeper, and see what do they mean by unlimited.

Hosting capacity

Of course, more details are on next link.

Unlimited files and sql

So, the real question is why do they sell it as unlimited if in fact there are so many limitations. It`s simple, it is a marketing trick. It`s stated that files must be used for websites and not for storage. So if we install an app like Own Cloud on our hosting and use it for uploading our pictures and videos on our hosting, those files are part of a website, yes? Correct, but the hosting provider will not allow you to do that. Yes you have an unlimited hosting plan, and all your files are part of a website, but if you go to tens of Gigabytes, you will be asked to reduce the number of files. If you do not comply very fast, they will shut you down. That is the fact. As I mentioned before, it is a marketing trick. It doesn`t mean that it is a bad product that should be avoided. On the contrary, few regular websites or blogs will fit and work like a charm. You just need to know what to expect.

Beware of the renewal!

Hosting and renewal

Many hosting providers are “fishing” their customers by price. It is often to see that you could get the great hosting plan for few bucks.Or even for a 1 $ price. Comparing to other products on the market it is much better and cheaper. You are so happy that you found that deal and you take it. You build your websites, set up your email accounts, and everything is just perfect. Then comes time to renew. Price now is doubled or even tripled. You start looking around and found plenty of cheaper products. But you already did set up everything and don’t know how to migrate everything to another provider. So you decide to pay your old hosting only this time.It will get you enough time to plan and migrate everything. Another year passes. Again it is a time to renew. Now price went even more up. You pay again swearing to yourself that this is the last time. Been there, know how it feels.

Here is an example. At least they stated that on renewal it will be a different price. Sometimes it is not stated at all, and you do not know until renewal time when you get the invoice.

Hosting @ HostGator

Look at this next example. You can figure out that something fishy here only by this little * after the price. On next page if you have a magnifying glass you can find this:

Hosting @ HostGator

So you can start with 6 $ per month but you will end up with around 15 $. Great service!

Coupons for everyone.

There are also coupons for many providers, and usually, they are baits on providers hook. They just wait for you to take them. Again if you plan to keep the product that you purchase for more than a year, renewal is gonna get you. Usually, coupons work only for a new product and they are worthless at the renewal time, so keep that in mind. They are great for short-term projects that last less than a year.

Customer comes first!

There are also some honest hosting providers that do the marketing the old way. For example, after more than ten years of struggle with different companies, I found one that sad that they will do their best to keep the same price of the product for as long as I use it. It is the fourth year now, and price did not go up. If you compare the price with others, it was not the cheapest, but when you take out that marketing tricks and calculate what you actually pay in let’s say three years period, it would be among the cheapest. I still pay the same price like I paid for the first time. I did not write this article to be an advertising for anyone, so I will not mention any names ar the addresses, but the Internet is huge, and it is a wise thing to do some research before purchasing a service.

Few pieces of advice at the end…

  • Think about what you actually need, don`t take the biggest package just because price looks great and the discount is unbelievable. Companies do not have fools in the Marketing department, they will take what is their one way or the other.
  • Do some researching, compare the prices, while watching out for the details about renewal price and things like that. If you do not understand something, feel free to contact the company and ask them about it. Believe me, they will answer.
  • Most hosting providers have multiple data centers worldwide, and when purchasing service you can choose the geographical location. Choose the location closest to the place where you expect that most of your customers/visitors will be.
  • I will say the same thing one more time, start with the smallest package that will do you a job, it is easy to upgrade/expand. Shrinking is the problem. Every company will allow you and even assist you to switch to a more expensive service. Usually, for a hosting, it is just a few clicks, and a payment, and you get, more space, databases, traffic, etc.
  • Figure out do you need Windows or Linux based web hosting. These days the difference in price and supported features is getting smaller and smaller, but there is generally an easy way to know which one do you need. If you are going to build or use something that requires .asp and .net use the windows hosting. For .php related stuff , use Linux.

You may also found interesting the article about Cloud computing.

Thank you for reading,


Posted in *.*, Internet

October 20th, 2017 by Chief

If the answer is yes look at this short guide that could save you some dimes or bucks in each Paypal transaction.
First of all, when you start Paypal transaction process it will offer you to chose funding options. It should look something like this picture.

Paypal conversion option

It is possible to see that conversion is already suggested, and by default, Paypal would do it.
The fact is that this is the worst option for you since their charges for conversion are sky-high. To change this setting you need to do some clicking. It is nicely complicated since Paypal does not want you to change it and yet must allow you the freedom to do it.

How to stop wasting money to Paypal

Like marked on the picture above, there is a tiny link that says “change” when you start the payment process. That is your starting point. After clicking that link you will get another confusing option like on the picture below. Actually, there is no option marked for the change of conversion provider. You need to click on the link that actually shows the exchange rate.

Paypal conversion options

After that, the magic option will appear and you will have the chance to change how will you do the conversion.

Paypal currency conversion

It is obvious that by default “Convert with Paypal” is selected. And please take a note that it would cost 5,19 BAM this way.

Paypal currency conversion

Now we are going to select “Convert with card issuer” option. At final something like this will appear showing your final step. It will not show you converted amount since conversion is not done by the Paypal.

Paypal currency conversion

Here is an SMS statement from the bank that says that transaction was made and it was 4.94 BAM.

Paypal currency exchange

Final result

It means that in this example it is  0.25 BAM less than it would be by default. It is roughly 5 % and Paypal would take it just because it is the default option and many people don’t know how to change it. I spoke with people that use the Paypal daily and even they did not figure it out. So next time when you make payment thru this service and your country currency is different than the one you are paying in to, take few seconds to change currency converter in order to avoid wasting money.

Another thing to avoid

If you have any pre-approved payments in Paypal, know the same thing applies to them also. In this case, there is no option to avoid currency conversion fees. For example,  I removed pre-approved payment for Netflix in my account, and now I`m paying for it by credit card directly. On 10 Euro transaction fee was around 30-40 Cents. It`s not a big deal, but I don`t like being robbed, even for few cents. They are processing millions of transactions daily, so do the math.
There are some interesting statistics on this link.

At the end don`t get me wrong, Paypal is a great service, and I`m not saying that you should avoid using it. This is just a tip to use it wisely.

Just a short update, not a two weeks after publishing this article, Paypal changed its default policy, and from now you are able to set conversion provider other than Paypal as a default. There are some more good changes, but this is the most important one. Thank you for listening Paypal!

Once again, thank you for reading.


Smartphone money saving upgrade.

Posted in *.* Tagged with: