For my home automation i’m using Home Assistant and Domoticz. All 433Mhz Temperature/Humidity are connected to a RFXcom device on two domoticx instances. (Master slave construction)
I’ve made a php script and a bash script to draw all sensors on a floorplan in realtime.
There is also a cron running which takes a snapshot of the generated image every 5 minutes. These images are being converted to MP4 and animated GIF to have a timelapse with all temperatures displayed on a floorplan.
The circles are where sensors are placed. Colors are from blue till red, representing the heat. In the center is the measured temperature value.
The (shortened) PHP script: (index.php)
<?php
header('Content-type: image/png');
// This is the floorplan empty ..
$png_image = imagecreatefrompng('plattegrondenmerge.png');
$white = ImageColorAllocate($png_image, 0, 0, 0);
$max = 40;
$min = -10;
// living
// getstate is a bash script (see below which gets the values from domoticz using curl)
// 840 is the domoticz idx
$temp840 = shell_exec('./getstate 840');
// A gray circle will be drawn if the temperature age is > 500 seconds
$age = shell_exec('./new.sh 18 840 500 >/dev/null || echo gray');
// location of circle
$start_x = 950;
$start_y = 760;
$line = $temp840 + 10;
// get x-th line from colors
$colorfromlist = shell_exec("tail --lines=$line ./colors2 | head -1");
if(strpos($age, "gray") !== false){
$colorfromlist = "128,128,128";
};
$colors = explode(",", $colorfromlist);
$color = imagecolorallocatealpha($png_image, $colors[0], $colors[1], $colors[2], 50);
// draw circle
imagefilledellipse ($png_image, $start_x, $start_y, 175, 175, $color);
$start_x = $start_x - 70;
$start_y = $start_y + 15;
// add text
imagettftext($png_image, 24, 0, $start_x, $start_y, $white, './verdana.ttf', $temp840);
// winecellar
$temp840 = shell_exec('./getstate 839');
$age = shell_exec('./new.sh 18 839 700 >/dev/null || echo gray');
$start_x = 560;
$start_y = 840;
$line = $temp840 + 10;
$colorfromlist = shell_exec("tail --lines=$line ./colors2 | head -1");
if(strpos($age, "gray") !== false){
$colorfromlist = "128,128,128";
};
$colors = explode(",", $colorfromlist);
$color = imagecolorallocatealpha($png_image, $colors[0], $colors[1], $colors[2], 50);
imagefilledellipse ($png_image, $start_x, $start_y, 175, 175, $color);
$start_x = $start_x - 70;
$start_y = $start_y + 15;
imagettftext($png_image, 24, 0, $start_x, $start_y, $white, './verdana.ttf', $temp840);
// ETC ETC
imagesavealpha($png_image, TRUE);
imagepng($png_image);
imagedestroy($png_image);
?>
getstate bash script (gets the temperature from domoticz instance1 given an idx)
I have a rol of printer paper that was used by an old 8bit computer. I forgot which one, one out of my collection.
I dont think it is thermal paper, maybe the printer uses electricity just like the movie clip you see below. (Well .. not using 220V directly on the paper maybe) 🙂
I wanted to control the input of my monitors, these are my findings.
DDC – Display Data Channel I2C – (Inter-Integrated Circuit, eye-squared-C), alternatively known as IIC, is a synchronous, multi-master/multi-slave (controller/target) bus
Getting monitor information with the ddccontrol -p command
##### PART OF THE OUTPUT #####
Detected monitors :
- Device: dev:/dev/i2c-9
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
(Automatically selected)
- Device: dev:/dev/i2c-7
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
- Device: dev:/dev/i2c-6
DDC/CI supported: Yes
Monitor Name: VESA standard monitor
Input type: Digital
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-9...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/AOC2490.xml"
Switching inputs
ddcutil -b 7 setvcp 0x60 0x11 # 7 is Second monitor (starts with 6), 0x60 is the input register (see below) and 0x11 is HDMI
ddcutil -b 6 setvcp 0x60 0x0f # First monitor DP (Displaylink)
alternative command
ddccontrol -r 0x60 -w 15 dev:/dev/i2c-7
List the control registers
ddccontrol -d dev:/dev/i2c-6
ddccontrol version 0.6.0
Copyright 2004-2005 Oleg I. Vdovikin (oleg@cs.msu.su)
Copyright 2004-2006 Nicolas Boichat (nicolas@boichat.ch)
This program comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of this program under the terms of the GNU General Public License.
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-6...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/AOC2490.xml"
Document not parsed successfully.
EDID readings:
Plug and Play ID: AOC2490 [VESA standard monitor]
Input type: Analog
=============================== WARNING ===============================
There is no support for your monitor in the database, but ddccontrol is
using a basic generic profile. Many controls will not be supported, and
some controls may not work as expected.
Please update ddccontrol-db, or, if you are already using the latest
version, please send the output of the following command to
ddccontrol-users@lists.sourceforge.net:
LANG= LC_ALL= ddccontrol -p -c -d
Thank you.
=============================== WARNING ===============================
Controls (valid/current/max) [Description - Value name]:
Control 0x02: +/1/2 C [New Control Value - No changes]
Control 0x04: +/0/1 C [Restore Factory Defaults]
Control 0x05: +/0/1 C [Restore Brightness and Contrast]
Control 0x08: +/0/1 C [Restore Factory Default Color]
Control 0x10: +/90/100 C [Brightness]
Control 0x12: +/50/100 C [Contrast]
Control 0x14: +/5/13 C [???]
Control 0x16: +/50/100 C [Red maximum level]
Control 0x18: +/50/100 C [Green maximum level]
Control 0x1a: +/50/100 C [Blue maximum level]
Control 0x60: +/772/4 C [Input Source Select (Main)]
Control 0x62: +/17/100 C [Audio Speaker Volume Adjust]
Control 0x6c: +/50/100 C [Red minimum level]
Control 0x6e: +/50/100 C [Green minimum level]
Control 0x70: +/50/100 C [Blue minimum level]
Control 0xac: +/6750/65535 [???]
Control 0xae: +/6000/65535 [???]
Control 0xb2: +/1/8 [???]
Control 0xb6: +/3/8 C [???]
Control 0xc8: +/5/65302 C [???]
Control 0xc9: +/8/65535 C [???]
Control 0xcc: +/4/255 [???]
Control 0xd6: +/1/4 C [DPMS Control - On]
Control 0xdf: +/513/65535 C [???]
Control 0xfe: +/4/255 [???]
Setting volume (reg 0x62) of monitor 2
ddcutil -b 7 setvcp 0x62 0x01
AOC monitorPROBLEM
You can’t switch from an input which is not active! So my workstation is connected via DP, and i can switch to HDMI. Now i HAVE TO use the hdmi to switch back to DP. A solution could be to ssh into the machine connected with HDMI (passwordless login) and switch back to DP. I made a mqtt button sending a topic that was read by the two machines using the mqtt python program elsewhere on this site. (Rotary Mqtt Volume control)