Jump to content


Popular Content

Showing content with the highest reputation since 10/10/2018 in all areas

  1. 1 point
    I have just switched an installation from a separate device with the agent to a VM on a Windows 10 computer acting as a home server. What I don't like about the setup is that it uses Virtualbox which runs only when a user is logged on. Secondly, I don't want to use Virualbox for my other VM's. So, here's how I did it: Installed and ran the Domotz agent for a first time, linking it to my account. Stop the VM and export it from within Virutalbox to the ovf 2.0 format, this also creates a VMDK file Use any tool to convert this to a vdk file (I used Starwind V2V) Create a virtual switch in Hyper V connected to the external network Create a new VM in Hyper V with the correct settings (copy the ones from Virutalbox) and use the vmdk file for the harddisk Start the VM (Optionally) set the VM to autostart when the computer starts If you follow these steps, you now have a VM with Domotz running in Hyper V as soon as the computer is started. You can then proceed to unistall Virtualbox and the Domotz Agent Manager. Honestly, I don't understand why the agent is not made available as a VM, rather than the complete package with the agent manager. It seems too complicated for the purpose to me. Disclaimer: not sure how this will survive any software upgrades by the Domotz team, use at your own risk.
  2. 1 point
    I have a Fish Tank with a temperature sensor installed on a Raspberry Pi Zero W that I wanted to monitor with Domotz Pro to receive push and emails alerts when the temperature is too high or too low. This is what I did: The sensor is the DS18B20. I wired it to the Raspberry Pi Zero this way: So I enabled OneWire support to read the sensor data: Add to the end of the file /boot/config.txt this line: dtoverlay=w1-gpio And restart the system: $init 6 To find out if the sensor was correctly recognized go to the folder /sys/bus/w1/devices/ and confirm that a 28-XXXXX folder has been created: $ cd /sys/bus/w1/devices/ $ ls 28-02079245a4ec w1_bus_master1 To read the temperature see the contents of the w1_slave file inside this folder: pi@FishTank:/sys/bus/w1/devices $ cd 28-02079245a4ec pi@FishTank:/sys/bus/w1/devices/28-02079245a4ec $ cat w1_slave bd 01 55 05 7f 7e 81 66 42 : crc=42 YES bd 01 55 05 7f 7e 81 66 42 t=27812 At that moment the water temperature was 27.812 Celsius. I'm using this script in Python (/home/pi/temp_snmp.py) to get the temperatures: #!/usr/bin/env python # -*- coding: utf-8 -*- import os import glob import time os.system('modprobe w1-gpio') os.system('modprobe w1-therm') base_dir = '/sys/bus/w1/devices/' device_folder = glob.glob(base_dir + '28*')[0] device_file = device_folder + '/w1_slave' def read_temp_raw(): f = open(device_file, 'r') lines = f.readlines() f.close() return lines def read_temp(): lines = read_temp_raw() while lines[0].strip()[-3:] != 'YES': time.sleep(0.2) lines = read_temp_raw() equals_pos = lines[1].find('t=') if equals_pos != -1: temp_string = lines[1][equals_pos+2:] temp_c = float(temp_string) / 1000.0 temp_c = round(temp_c, 2) # temp_f = temp_c * 9.0 / 5.0 + 32.0 return temp_c # return temp_f temp = read_temp() print temp There are several other sensors that you can use with the Raspberry Pi, just create a script that print the current temperature. To create the OID make sure that you have installed the snmp packages: $sudo apt-get install snmp snmpd Add to the end of the file /etc/snmp/snmpd.conf: pass . /bin/sh /home/pi/temp_snmp.sh -g Create the script file /home/pi/temp_snmp.sh with the following content: #!/bin/bash if [ "$1" = "-g" ] then echo . echo integer #set the OID as INTEGER python -u /home/pi/temp_snmp.py #it will print the actual temperature. fi exit 0 Now, stop the snmpd service and run it using your actual user (if something goes wrong check the log file errlog.txt): $sudo service snmpd stop $snmpd -Lf errlog.txt And confirm that everything is working fine: $ snmpget -v2c -c public . iso. = INTEGER: 28 As you can see, every time you read the OID . it will run the script that will return the temperature value. Now you can setup the Domotz Eyes to read the SNMP sensor and create the Alerts: Following this same example you can create your own SNMP sensors and monitor them using your Domotz Pro agent. This way I can receive alerts whenever the temperature goes down or increases too much: To better understand the syntax used in the snmpd.conf file refer to the man page (man snmpd.conf). Do not hesitate to comment or share your own project in our community. Henrique Salvador Domotz Support