Gettign the value from a temperature device in a python plugin

Python and python framework

Moderator: leecollings

Post Reply
akamming
Posts: 359
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Gettign the value from a temperature device in a python plugin

Post by akamming »

Hi,

i am trying to write a python plugin which derives the needed boiler temp from an outside temperature device

however i cannot find a way how to get access to a temperature sensor which was not created by the pluing (e.g. i have a idx number from the temperature sensor, how can i get the value of that sensor in a python plugin)

Does someone have some sample code i can use?
pipiche
Posts: 2005
Joined: Monday 02 April 2018 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by pipiche »

A plugin can only see its own devices. Is really a plugin you need ? Or a python/lua/dzVent script would be better ?

Otherwise you can use jsonnAPI inside the plugin ( which I don’t think is great)


Envoyé de mon iPhone en utilisant Tapatalk
Zigbee for Domoticz plugin / RPI3B+ / Electrolama ZZH-P / 45 devices

If the plugin provides you value, you can support me with a donation Paypal.

Wiki is available here.

Zigbee for Domoticz FAQ
akamming
Posts: 359
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by akamming »

pipiche wrote: Saturday 15 May 2021 20:56 A plugin can only see its own devices. Is really a plugin you need ? Or a python/lua/dzVent script would be better ?

Otherwise you can use jsonnAPI inside the plugin ( which I don’t think is great)
Tx. i could fix with a python/lua/dzvents script, but i really like the fact that the plugin creates and manages it's own devices. Saves a lot of manual work creating the virtual devices.

I already used the json API as a workaround. It works, but requires that the plugin know the IP Adress and port from the domoticz instance. It is now a configurable parameter in the plugin, but it would be better if this could be retrieved from the domoticz config within the python code. Does anyone know how?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by waaren »


akamming wrote: Saves a lot of manual work creating the virtual devices.
A lot of work?
Takes about 20 seconds per device (if you type as slow as me) Image




Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
akamming
Posts: 359
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by akamming »

waaren wrote: Sunday 16 May 2021 21:33 A lot of work?
Takes about 20 seconds per device (if you type as slow as me) Image
and multiply that by 25 virtual devices :D

besides now i don't get error's on this script if i accidentally delete a device, it is recreated by the plugin.
Masure
Posts: 35
Joined: Sunday 22 April 2018 11:23
Target OS: Windows
Domoticz version:
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by Masure »

I had the same concern and created a topic : viewtopic.php?f=65&t=35121

Getting access to other devices state with read only access from a plugin would be very useful.
User avatar
waltervl
Posts: 5714
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Gettign the value from a temperature device in a python plugin

Post by waltervl »

Masure wrote: Wednesday 25 August 2021 14:36 I had the same concern and created a topic : viewtopic.php?f=65&t=35121

Getting access to other devices state with read only access from a plugin would be very useful.
A plugin is only to be used to create and control the related hardware. Of you want to control/modify devices based on other devices you need scripting like Blockly, Lua, DzVents etc who have a view over all Domoticz devices.
If you accidentally would like to use one then the http API way of working would do.
It is the same for C++ Hardware plugins I presume.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

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