Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Friday, October 6, 2023

Connect to Fluvius smart energy meter via P1 and publish data via MQTT broker to Home Assistant

I created a python script that runs as a service to read out the Fluvius energy meter via the P1 port to USB on a Raspberry Pi. See installation notes here: https://github.com/smartathome/fluvius2mqtt/tree/main

The output into Home Assistant looks like this:



Tuesday, December 13, 2016

Testing a basic Zwave setup for the first time

I have myself ordered a Zwave.me USB stick and an Aeotec MultiSensor 6 to start building my sensor network at home. There are a few tools out there to get you started with Zwave on a Raspberry Pi, or see my howto. But the issue I had was that I was not able to see the technical configuration of my hardware devices. There is a script called api_help.py that comes with the python_openzwave library, that I have slightly modified so that it prints the useful information in a friendly way.

Output:
pi@raspberrypi:~/git/python_openzwave $ python3 api_demo.py
------------------------------------------------------------
------------------------------------------------------------
Memory use : 14.61328125 Mo
INFO:openzwave:Start Openzwave network.
------------------------------------------------------------
Waiting for network awaked :
------------------------------------------------------------
.INFO:openzwave:Driver ready using library Static Controller version Z-Wave 4.05
INFO:openzwave:home_id 0x00000000, controller node id is 1
......... done
------------------------------------------------------------
Memory use : 15.96484375 Mo
------------------------------------------------------------
Use openzwave library : 1.4.2272
Use python library : 0.3.1
Use ZWave library : Static Controller version Z-Wave 4.05
Network home id : 0x00000000
Controller node id : 1
Controller node version : 4
Nodes in network : 2
------------------------------------------------------------
Waiting for network ready :
------------------------------------------------------------
 done in 10 seconds
Memory use : 15.96484375 Mo
------------------------------------------------------------
Controller capabilities : {'primaryController'}
Controller node capabilities :
{'primaryController', 'listening', 'beaming'}
Nodes in network : 2
Driver statistics :
{   'ACKCnt': 22,
    'ACKWaiting': 3,
    'CANCnt': 3,
    'NAKCnt': 0,
    'OOFCnt': 0,
    'SOFCnt': 44,
    'badChecksum': 0,
    'badroutes': 0,
    'broadcastReadCnt': 0,
    'broadcastWriteCnt': 12,
    'callbacks': 0,
    'dropped': 0,
    'netbusy': 0,
    'noack': 0,
    'nondelivery': 0,
    'readAborts': 0,
    'readCnt': 44,
    'retries': 3,
    'routedbusy': 0,
    'writeCnt': 25}
------------------------------------------------------------
New node: Node 1
   ---------
Node 1 - Name :
Node 1 - Manufacturer name / id : Z-Wave.Me / 0x0115
Node 1 - Product name / id / type : ZME_UZB1 USB Stick / 0x0001 / 0x0400
Node 1 - Version : 4
Node 1 - Command classes :
{'COMMAND_CLASS_NO_OPERATION', 'COMMAND_CLASS_BASIC'}
Node 1 - Capabilities : {'primaryController', 'listening', 'beaming'}
Node 1 - Neigbors : {2}

Thursday, December 1, 2016

Install Louie for Python3

I needed Louie for a Python3 script, but it is not available through apt-get. To install directly from the github, just use the following command which makes use of pip3.

pi@raspberrypi:~ $ sudo pip3 install git+git://github.com/11craft/louie.git

In order to check for the installed modules in your python3 installation:
>>> import pip
>>> installed_packages = pip.get_installed_distributions()
>>> installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
...      for i in installed_packages])
>>> print(installed_packages_list)
['babel==2.3.4', 'flask-babel==0.9', 'flask-socketio==2.8.1', 'flask-themes==0.1.3', 'flask-wtf==0.9.5', 'flask==0.10.1', 'gevent-socketio==0.3.6', 'gevent-websocket==0.9.5', 'gevent==1.1.1', 'greenlet==0.4.10', 'itsdangerous==0.24', 'libopenzwave==0.3.1', 'louie==1.2a1dev', 'nose==1.3.7', 'openzwave==0.3.1', 'pydispatcher==2.0.5', 'pyozwman==0.3.1', 'pyozwweb==0.3.1', 'python-engineio==1.1.0', 'python-socketio==1.6.1', 'pytz==2016.7', 'pyyaml==3.12', 'six==1.10.0', 'speaklater==1.3', 'urwid==1.3.1', 'virtualenv==15.1.0', 'webob==1.7.0rc1', 'werkzeug==0.11.11', 'wtforms==1.0.5']