Writing Python Plugins for hardware

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
Nettime
Posts: 15
Joined: Friday 14 December 2018 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Writing Python Plugins for hardware

Post by Nettime »

If my inertia persists I will during the next few months write plugins for:
Advantec ADAM 6050 and 6017 Digital and Analog Ethernet OPC units:
currently started on 6050 and have the 12 digital inputs pushed to a utility text applet as binary.
Many thanks for the "UDP Discovery.py" example as it both shows UDP usage and "on the fly" device creation.
Will also need to be able to set the outputs and leaning towards TCP for that, I think the "Pinger.py example" will do nicely for that as I want confirmation that the outputs really gets set.
Have not found much information about the default device applets so wondering if there is some visual document from which to select for inputs?


CARLO GAVAZZI EM340 DIN AV2.3.X M1 PF Meter-Bus (M-bus) Energy meter:
If i get it to work will use one of the Pi's serial ports with DIY M-Bus driver.
Target to get to the Ampere readings.
Anyone sitting on a M-bus direct communication example? (dont want to complicate things with dependencies)

Tillquist LQT60 WIDE Mod-bus Energy Meter:
Target to get to the Ampere readings.
Dont have a RS-485 adapter as yet so this will probably have low priority, dont have any real use for it until late spring anyway.
Anyone sitting on a Mod-bus direct communication example?

I'm quite lazy as programmer and have no intention to learn Python besides what I glance from reusing others code and bare minimal to format input/output. So please elaborate if you have the time. (At my age it doesn't stick anyway.)
Thanks
Nettime
Posts: 15
Joined: Friday 14 December 2018 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by Nettime »

Ok ran into a bit of a snatch as I can not figure out how to write a nice plugin for a multiple IO.
My solution so far would be to have a text device as "master" for testing purposes and create 12 switch devices "on the fly"
My problem with this is setting the status of the switches as all examples I have been able to find use "Name =" to set status and
that makes for some ugly code.
Can you set status by "ID:" instead?
Also I can not seem to find the descripton of the Domoticz module anywhere?
Nettime
Posts: 15
Joined: Friday 14 December 2018 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by Nettime »

As I haven't had any responses yet I gather my hardware is of low intrest.
Well my sole purpose at the moment for messing with the ADAM module is to get a bit more control of the "Home mode" in Synology without buying an extra licence, this eventually lead to the need for a Synology plugin, should have seen that one coming :) . Anyway It's up and running wit read/set done but ugly code wich seems to be my hallmark, cant seem to figure out how to get the raw http data into something handy like dict or json for smoother coding.
The returned message seems to claim to be dict but my efforts to decode or lift key values from it fails repeatadley, and looking at the message I can't say that dict should stand much of a chance decoding it?

Code: Select all

{'Headers': {'Server': 'nginx', 'X-XSS-Protection': '1; mode=block', 'Keep-Alive': 'timeout=20', 'P3P': 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"', 'Set-Cookie': 'id=72aJrAeTWBdbAD2KVN04035;expires=Mon, 24-Dec-2018 23:18:06 GMT;path=/\nsmid=H9vH7DPXks0mHXb3U0KKYu3kL57AjHNar_BI5j8EF7XGK3rYNg6xA4RXes6lykHFD1FZLqhe4cx6kaNCcrXq6A;expires=Tue, 17-Dec-2019 23:18:06 GMT;path=/;HttpOnly', 'Date': 'Mon, 17 Dec 2018 23:18:06 GMT', 'Content-Type': 'text/plain; charset="UTF-8"', 'Vary': 'Accept-Encoding', 'Transfer-Encoding': 'chunked', 'X-Content-Type-Options': 'nosniff', 'Connection': 'keep-alive'}, 'Data': b'{"data":{"sid":"72aJrAeTWBdbAD2KVN04035"},"success":true}\n', 'Status': '200'}
2018-12-18 00:18:06.442 (DSM) {"data":{"sid":"72aJrAeTWBdbAD2KVN04035"},"success":true}
Formatted by Domoticz.log I gather it's 2byte and includes the "chunked" info , this is just the "login" reply so very short compared to the "read" reply.
But both http and Data part are of intrest for error checking. I'm using common string functions to hack the data out atm.
But any suggestion on how to parse it to a proper dict or json appreciated.

/ Regards Net-time
Nettime
Posts: 15
Joined: Friday 14 December 2018 9:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by Nettime »

Right. Was a dictionary. Did not know phyton Dict could be nested.
Any way I have the m-bus up and running . The diy adapter on the limbus site Did not work with my
Profilic usb adapter. I had to invert the signals. I think I will probably do a Quick hack of the m-bus reply
as the protocol seems to have been added to in afterthought instead of scrapped and started over.
Probably just like my coding but I just do it for fun. I'm aware of the limbus library but that dont seem to be of much use for a plugin.
Merry Christmas :geek:
Eravinera
Posts: 4
Joined: Tuesday 26 March 2019 17:02
Target OS: Windows
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by Eravinera »

I remember when I was studying at a programmer at one of the universities in Toronto, I also encountered a similar problem. But I had such problems rarely, most often I had problems with writing essays and similar works. Writing these works takes a lot of time and for this, I prefer to buy online essays, just view website and you will see that this is the best option. This service provides the highest quality work of any complexity in a short period of time. Thus, you have enough time to devote to its programming and not only.
WilliamStumpf90
Posts: 2
Joined: Monday 27 January 2020 22:42
Target OS: -
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by WilliamStumpf90 »

Eravinera wrote: Wednesday 27 March 2019 13:59 I remember when I was studying at a programmer at one of the universities in Toronto, I also encountered a similar problem. But I had such problems rarely, most often I had problems with writing essays and similar works. Writing these works takes a lot of time and for this, I prefer to buy online essays, just view website and you will see that this is the best option. This service provides the highest quality work of any complexity in a short period of time. Thus, you have enough time to devote to its programming and not only.
this is very useful, thank you! I will heed your advice, but I understand that the data needs to be verified. I have not heard good reviews from you about this site and so I would better choose from the top writers about whom you can find information, read reviews and evaluate the quality of the work.
Last edited by WilliamStumpf90 on Monday 09 March 2020 11:13, edited 1 time in total.
User avatar
AlanGpio
Posts: 15
Joined: Monday 24 February 2020 21:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by AlanGpio »

WilliamStumpf90 wrote: Sunday 01 March 2020 21:16
Eravinera wrote: Wednesday 27 March 2019 13:59 I remember when I was studying at a programmer at one of the universities in Toronto, I also encountered a similar problem. But I had such problems rarely, most often I had problems with writing essays and similar works. Writing these works takes a lot of time and for this, I prefer to buy online essays, just view website and you will see that this is the best option. This service provides the highest quality work of any complexity in a short period of time. Thus, you have enough time to devote to its programming and not only.
this is very useful, thank you!
Take care, MalwareBytes flags the site as Malware
.
malware.jpg
malware.jpg (37.04 KiB) Viewed 1192 times
Hobbyist developing home automation on a Rasp Pi 4 under Buster off SSD.
Custom electronics to link to alarm system, doors, lights, cameras and door bell.
Running Domoticz in a Docker Container along with containers for Moquitto and Portainer.
Alisson4
Posts: 1
Joined: Friday 25 September 2020 17:06
Target OS: Windows
Domoticz version:
Contact:

Re: Writing Python Plugins for hardware

Post by Alisson4 »

It's great that you have told us about it, but can you please give me an advice and recommend something like that as well? I know that there are a lot of scammers so please help me and name a few good essay writing services. Thank you in advance!
ValentinMiller
Posts: 1
Joined: Monday 05 April 2021 20:00
Target OS: Windows
Domoticz version:
Location: Atlanta, GA
Contact:

Re: Writing Python Plugins for hardware

Post by ValentinMiller »

I also had to dock using Python for such purposes and for write my essay 4 me, and how glad I am that microcontrollers can be programmed in an adequate language
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest