Important community news
Release pimatic-raspbee@0.1.6

Hi again,
at least the one nasty plug is now also running propperly incl. all measurements (voltage, current, power, consumption).
I never saw such a wondering behaviour with a ZigBee device, but in the end it worked.
If one might run into similiar issues with the Tuya/Blitzwolf BW-SHP13, please have a look here:

One have to scroll down to the very bottom… ;-)

canedje created this issue in dresden-elektronik/deconz-rest-plugin open HEIMAN BW-SHP13 look a like is not showing powerconsumption #3788

read more
Everything that doesn't fit elsewhere
Problem with MQTT Client in pimatic

Hello everybody,

I have a problem with the MQTT Client in pimatic.

It is the first time I use ESP32 microcontroller to create a Bluetooth Low Energy presence control.
After detection a known device I send the data to my pimatic server with MQTT. It works but sometimes I got this error message:

error [pimatic]: An uncaught exception occurred: TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at /home/pi/pimatic-app/node_modules/pimatic-mqtt/devices/
at MqttClient.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-mqtt/devices/
at MqttClient.emit (events.js:203:15)
at MqttClient._handlePublish (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/lib/client.js:1162:12)
at MqttClient._handlePacket (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/lib/client.js:351:12)
at work (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/lib/client.js:283:12)
at Writable.writable._write (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/lib/client.js:294:5)
at doWrite (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:428:64)
at writeOrBuffer (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:417:5)
at Writable.write (/home/pi/pimatic-app/node_modules/pimatic-mqtt/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:334:11)
at Socket.ondata (_stream_readable.js:709:20)
at Socket.emit (events.js:198:13)
at Socket.emit (/home/pi/pimatic-app/node_modules/pimatic/
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
This is most probably a bug in pimatic or in a module, please report it!

Moreover my three ESP32-devices (for three rooms) lose the MQTT-connection.

Before I had integrated my ESP32-devices in my system I used MQTT only to transfer data from sensors like PIR or DS1820 to pimatic. It worked fine.
Then I expanded my system. I controlled two Wifi-Tuya-sockets with a Python-script and used MQTT too. No problem.
But now I got these error messages you can see above.

Is it my fault cause of my terrible source code or is it a bug in pimatic or in a module? I hope someone can help me. Thanks a lot!

And here is the sketch for the ESP32. It is a modified program. The original source code is from

Currently I want to detect only person1 with a smartwatch.

#include <EEPROM.h>

MQTT Bluetooth (BLE) Anwesenheitserkennung. Raum präsenzmelder für Hausautomatisierung. Personen präsenz im Zimmer durch:
iBeacon, Mi Band fitness tracker, smartwatch aufspüren. Publish ist MQTT_Name, Daten MAC und RSSI in JSON Format alle 10s
FHEM, Node-RED, iobroker, openHAB, Domoticz */

#include <WiFi.h>
#include <WiFiClient.h>
#include <PubSubClient.h>
#include <BLEDevice.h>
#include <BLEScan.h>
#include <BLEAddress.h>

#include <ArduinoJson.h>

// MQTT Zugangsdaten
#define MQTT_server “”
#define MQTT_port 1883
#define MQTT_User “”
#define MQTT_Pass “”
#define MQTT_Name “BLE_Scanner_irgendwas” // gleichzeitig publish Name
#define QoS 0

const char* ssid = “xxxxxxxx”; // WLAN Zugangsdaten Eintragen
const char* password = “xxxxxxxxxxxxxxxxxx”;

const String MAC_Amazfit_BIP = “xx:xx:xx:xx:xx:xx”;
const String MAC_BLE_ITAG = “FF:FF:FF:FF:FF:FF:FF:FF”;

const int txPower_BLE = -77; // gemessene Signalstärke RSSI in ein Meter Entfernung

int scanTime = 10; //sek. iBeacon Suchzeit und MQTT Berichtinterval
BLEScan* pBLEScan ;

// --------------- MQTT Variablen ---------------------------------------
WiFiClient wclient;
PubSubClient mqtt(wclient);

void setup()
int i;


// --------------------- WiFi ---------------------------------------------
Serial.println(“Warte auf Verbindung”);
WiFi.mode(WIFI_STA); ;
WiFi.begin(ssid, password);
int timout = 0;
while (WiFi.status() != WL_CONNECTED)
if (timout > 20) // Wenn Anmeldung nicht möglich
Serial.println(“Wlan verbindung fehlt”);
ESP.restart(); // ESP32 neu starten
Serial.print("IP Addresse: ");

// ---------------------- MQTT ---------------------------------------------------
mqtt.set_server(MQTT_server, MQTT_port); // MQTT Port einstellen
if (mqtt.connect(MQTT::Connect(MQTT_Name).set_auth(MQTT_User, MQTT_Pass)))
Serial.println(“Mit MQTT verbunden”);
mqtt.publish(MQTT::Publish(“hallo”, MQTT_Name).set_qos(QoS)); // im Topic hallo Präsenzmelder Name schreiben

Serial.println(“Starte BLE Scanner”);
pBLEScan = BLEDevice::getScan();
pBLEScan->setActiveScan(true); // Aktives Bluetooth Scannen

void loop()
int j;

String Treffer;
double amazfit_distance = 1000, itag_distance= 1000;
int treffer_rssi;
float pow_exponent, rssi_diff;

int Person1 = 0, Person2 = 0;

char trefferbuffer[1024];

StaticJsonDocument<1024> JSONbuffer;

BLEScanResults foundDevices = pBLEScan->start(scanTime); // BLE Scanen

for (j = 0; j < foundDevices.getCount(); j++) // Alle Gefundene Bluetooth Device durchgehen
Treffer = foundDevices.getDevice(j).getAddress().toString().c_str();
if (Treffer == MAC_Amazfit_BIP)
treffer_rssi = foundDevices.getDevice(j).getRSSI();
Serial.println(“Person1 ist in der Küche”);

rssi_diff = txPower_BLE - treffer_rssi; pow_exponent = rssi_diff / 20; amazfit_distance = pow(10, pow_exponent); Serial.println("Distanz: " + String(amazfit_distance)); Person1 = 1; // ID für die Küche j = foundDevices.getCount(); } if (Treffer == MAC_BLE_ITAG) { treffer_rssi = foundDevices.getDevice(j).getRSSI(); //Serial.println("Person2 ist in der Küche"); rssi_diff = txPower_BLE - treffer_rssi; pow_exponent = rssi_diff / 20; itag_distance = pow(10, pow_exponent); Serial.println("Distanz: " + String(itag_distance)); Person2 = 1; // ID für die Küche } JSONbuffer["person1"] = Person1; JSONbuffer["distance1"] = amazfit_distance; JSONbuffer["person2"] = Person2; JSONbuffer["distance2"] = itag_distance;

} // Alle gefundene MACs durchgehen

pBLEScan->clearResults(); // Speicher freigeben

serializeJson(JSONbuffer, trefferbuffer);
mqtt.publish(MQTT::Publish(MQTT_Name, trefferbuffer).set_qos(QoS)); // JSON per MQTT senden
if (WiFi.status() != WL_CONNECTED) ESP.restart(); // Wenn Wlan fehlt neustarten
if (mqtt.connected())
Serial.println(“MQTT Verbindung fehlt”); // Wenn MQTT Verbindung fehlt dann neu verbinden
mqtt.connect(MQTT::Connect(MQTT_Name).set_auth(MQTT_User, MQTT_Pass));
} // ende MQTT Verbindung ja/nein

read more
You have a cool idea about pimatic?
Variable currentUser

This feature request as is is not implementable at present

read more
Here you will find good setup tutorials!
Rhasspy voice control integration for pimatic

Hello everyone,

I have used pimatic for several years now and I am a relatively new rhasspy user and I would like to share my settings to others to easyly integrate voicecontrol in your pimatic workflow.

Bild TextRhasspy is an open source, fully offline set of voice assistant services for many human languages.

I have a connection to rhasspy through node-red by easy to use pimatic-nodes which call the api.

Here is the node setup for it :

[{“id”:“b56e15b3.3ccbc8”,“type”:“websocket in”,“z”:“aaed059b.58cda8”,“name”:“rhasspy”,“server”:“63453288.fa038c”,“client”:"",“x”:70,“y”:340,“wires”:[[“d4b7ed96.952cb”]]},{“id”:“d4b7ed96.952cb”,“type”:“switch”,“z”:“aaed059b.58cda8”,“name”:“intent filter”,“property”:“”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“GetTime”,“vt”:“str”},{“t”:“eq”,“v”:“PimaticDevice”,“vt”:“str”},{“t”:“eq”,“v”:“SetVolume”,“vt”:“str”},{“t”:“eq”,“v”:“PimaticVar”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:4,“x”:230,“y”:340,“wires”:[[“8a77ee83.2a136”],[“af1a6eab.b3”],[],[“8f662ea3.5596f”]]},{“id”:“3cdc64ba.ce7c1c”,“type”:“http request”,“z”:“aaed059b.58cda8”,“name”:“text to speech”,“method”:“POST”,“ret”:“txt”,“paytoqs”:“ignore”,“url”:“http://yourrhasspyhost:12101/api/text-to-speech",“tls”:"",“persist”:false,“proxy”:"",“authType”:“basic”,“x”:680,“y”:220,“wires”:[[]]},{“id”:“f7f1aa3f.3cbca8”,“type”:“debug”,“z”:“aaed059b.58cda8”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:true,“complete”:“payload”,“targetType”:“msg”,“statusVal”:“payload”,“statusType”:“auto”,“x”:670,“y”:160,“wires”:[]},{“id”:“8a77ee83.2a136”,“type”:“function”,“z”:“aaed059b.58cda8”,“name”:"time text”,“func”:“var timeString = new Date().toLocaleTimeString([],\n{\n timeZone:“Europe/Berlin”,\n hour: “2-digit”, \n minute: “2-digit”,\n hour12: false\n})\n\nreturn {\n payload: “Es ist jetzt " + timeString\n}”,“outputs”:1,“noerr”:0,“initialize”:”",“finalize”:"",“libs”:[],“x”:500,“y”:200,“wires”:[[“f7f1aa3f.3cbca8”,“3cdc64ba.ce7c1c”]]},{“id”:“7d3dc201.fa32ec”,“type”:“rule action”,“z”:“aaed059b.58cda8”,“controller”:“505b6b31.6cc664”,“actionExpression”:"${ payload }",“messageOnError”:true,“name”:"",“x”:710,“y”:320,“wires”:[[“ebc3b01e.e3ccb”,“c8c030e5.1ad7f”]],“inputLabels”:["${ payload }"],“outputLabels”:[“msg.payload”]},{“id”:“af1a6eab.b3”,“type”:“template”,“z”:“aaed059b.58cda8”,“name”:"",“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:“turn {{ slots.device }} {{ slots.state }}”,“output”:“str”,“x”:500,“y”:320,“wires”:[[“7d3dc201.fa32ec”]]},{“id”:“4bbe64c7.19c75c”,“type”:“debug”,“z”:“aaed059b.58cda8”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:true,“complete”:“payload”,“targetType”:“msg”,“statusVal”:“payload”,“statusType”:“auto”,“x”:890,“y”:400,“wires”:[]},{“id”:“ebc3b01e.e3ccb”,“type”:“debug”,“z”:“aaed059b.58cda8”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:true,“complete”:“payload”,“targetType”:“msg”,“statusVal”:“payload”,“statusType”:“auto”,“x”:890,“y”:280,“wires”:[]},{“id”:“35d78f2c.1e405”,“type”:“inject”,“z”:“aaed059b.58cda8”,“name”:"",“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“60”,“crontab”:"",“once”:false,“onceDelay”:0.1,“topic”:"",“payload”:"",“payloadType”:“date”,“x”:230,“y”:420,“wires”:[[]]},{“id”:“8f662ea3.5596f”,“type”:“template”,“z”:“aaed059b.58cda8”,“name”:"",“field”:“payload”,“fieldType”:“msg”,“format”:“handlebars”,“syntax”:“mustache”,“template”:“set {{ slots.pivar }} to {{ slots.piwert }}”,“output”:“str”,“x”:500,“y”:400,“wires”:[[“3c60a0f8.50da”]]},{“id”:“c8c030e5.1ad7f”,“type”:“http request”,“z”:“aaed059b.58cda8”,“name”:“text to speech”,“method”:“POST”,“ret”:“txt”,“paytoqs”:“ignore”,“url”:“http://yourrhasspyhost:12101/api/text-to-speech",“tls”:"",“persist”:false,“proxy”:"",“authType”:“basic”,“x”:900,“y”:340,“wires”:[[]]},{“id”:“3c60a0f8.50da”,“type”:"rule action”,“z”:“aaed059b.58cda8”,“controller”:“505b6b31.6cc664”,“actionExpression”:"${ payload }",“messageOnError”:true,“name”:"",“x”:710,“y”:400,“wires”:[[“4bbe64c7.19c75c”]],“inputLabels”:["${ payload }"],“outputLabels”:[“msg.payload”]},{“id”:“63453288.fa038c”,“type”:“websocket-listener”,“path”:“ws://yourhost:12101/api/events/intent”,“wholemsg”:“true”},{“id”:“505b6b31.6cc664”,“type”:“controller”,“name”:“Pimatic”,“protocol”:“http”,“host”:“yourhost”,“port”:“80”,“path”:"",“username”:“yourusername”,“password”:“yourpw”}]

You have to insert your user, passwords, hosts etc. in the corresponding nodes.

For the configuration in Rhasspy I have “special” sentences to insert variables and build the commands for pimatic and slots for the devices and variable you want to call.

[GetTime] wie spät ist es [(jetzt|momentan|gerade|aktuell|eigentlich)] sag miir (die uhrzeit | wie spät es ist) wie viel uhr (ist es|haben wir) [gerade] wie ist die uhrzeit welche uhrzeit haben wir [(gerade | aktuell)] [PimaticDevice] (schalte | mach) [die | der | das] $device{device} ((ein | an):on | aus:off){state} [PimaticVar] (setze | setze | stelle) [die | der | das] $pivar{pivar} auf (0…100){piwert} [grad | prozent]

Slots for device :

[device] (verstärker | audio | lautsprecher):verstarker (auto haustür):auto-haustur stehlampe:steckdose10 arbeitsleuchte:S-20-001 (gute nacht):gute-nacht (beamer | fernseher):beamer2

And slots for variables to set :

[pivar] ((heizung im bad) | (temperatur im bad) | badezimmertemperatur):$temp-soll

For the syntax of sentences and slots you can read here :

Both slots can be easyly expanded with all devices want to turn on or off, or variables you want to set.

In Pimatic there is nothing to configure.

Sorry for the content in german, hope it is helpful for some of you.
Feel free to ask questions or find mistakes :wink:

read more
Discussion about Hardware.
Recommendation for controlling shutters

In the meantime two Shelly 2.5 are now working within my wall and are now integrated with pimatic. Works really well and I really like the local web interface of the Shelly relais. Thanks to @bertreb I’m even able to control them using the Google Assistant.

read more

All about code

New plugin pimatic-assistant

I’m waiting for the new plugin … thanks for the implementation

read more
All about rules and script develpopment
How to control onkyo receiver

no, I didn’t, but it was actually a clean basic installation with a clean installation of the script with this lines
but i will set up a completely new system with pimtaic for testing

sudo apt install python3-pip
pip3 install
export PATH=${PATH}:/home/pi/.local/bin
onkyo --discover

read more
Please report bugs on github!

Looks like your connection to pimatic forum was lost, please wait while we try to reconnect.