SDM120C - RS485 Meter

Moderator: leecollings

Post Reply
fabix68
Posts: 10
Joined: Tuesday 22 December 2015 6:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

SDM120C - RS485 Meter

Post by fabix68 »

Hello.
I'm trying to use Domoticz for power management in my apartment.
I use the meter SDM120C RS48-mode connected to the Raspberry PI.
I installed the library MODBUS
When doing a "sdm120c -A1 -PN -b 9600 / dev / ttyUSB0" I get this data

Voltage: V 233.40
Current: 2.37 A
Power: 545.10 W
Active Apparent Power: 548.72 VA
Reactive Apparent Power: 0.00 VAR
Power Factor: 1.00
Phase Angle: 0.00 Degree
Frequency: 50.00 Hz
Import Active Energy: 1842537 Wh
Export Active Energy: 0 Wh
Total Active Energy: 1842537 Wh
Import Reactive Energy: 273398 VARh
Export Reactive Energy: 0 VARh
Total Reactive Energy: 273398 VARh
OK

I can import them into Domoticz?
TNK
gianfrdp
Posts: 11
Joined: Sunday 10 January 2016 3:22
Target OS: Linux
Domoticz version: 3.8805
Contact:

Re: SDM120C - RS485 Meter

Post by gianfrdp »

Hello,

First of all you have to define a virtual sensor, type 'Electric'
You can create a script that reads values and sends them to domoticz using JSON API.

For example, if domoticz IP is 192.168.2.31 and idx for virtual meter is 2:

Code: Select all

#!/bin/sh
W=`sdm120c -a 1 -b 9600 -pq /dev/ttyUSB0 | awk '{print $1}'`
WH=`sdm120c -a 1 -b 9600 -iq /dev/ttyUSB0 | awk '{print $1}'`
curl -s "http://192.168.2.31:8080/json.htm?type=command&param=udevice&idx=2&nvalue=0&svalue=$W;$WH"
Execute script via cron
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest