How to get 'local/internal' values into Domoticz

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
chrisisbd
Posts: 10
Joined: Tuesday 24 November 2026 12:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How to get 'local/internal' values into Domoticz

Post by chrisisbd »

I am trying out Domoticz on a couple of Raspberry Pi systems. These two systems already have some sensors connected directly to the hardware (I2C and other ways) and I have simple python scripts reading values and storing them so they can be shared across my LAN.

Is there any simple way to get these measurements and states directly into Domoticz? I don't really want to have to wrap the values up as a message in some sort of protocol that Domoticz understands and have the system send it to itself.

Do dummy switches and dummy sensors do what I want? I've read the wiki and I've created some of these but I don't quite seem to have got what I want yet. Is there a guide anywhere on how to do it?

Thanks.
gerardvs
Posts: 102
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by gerardvs »

Yes, create dummy devices and update them via the json/api (see Wiki). You can do that directly from python.
BartSr
Posts: 560
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by BartSr »

maybe publish your sensors using mqtt?
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
willemd
Posts: 803
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.3
Location: The Netherlands
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by willemd »

Isn't this a duplicate question? viewtopic.php?f=28&t=45358

If you don't want to use another protocol, like MQQT for example, you could use a dzvents script with asynchronous shell command (see dzvents wiki) to start any type of python program to get these values from your remote system into your central domoticz system (use JSON commands to insert into domoticz, see JSON wiki)
chrisisbd
Posts: 10
Joined: Tuesday 24 November 2026 12:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by chrisisbd »

These are not things I want to send from one system to another. They are simply values that I have available on the system where Domoticz is running that I want to get into Domoticz. So the first answer seems to be what I want:-

> Yes, create dummy devices and update them via the json/api (see Wiki). You can do that directly from python.

I think I have found some of the documentation about this, however I can't see anything specifically for switch **inputs**. I.e. I want to display the status of a logic input. I will go and have a longer, harder look at json/api in the Wiki though. I'm slightly familiar with JSON as I use it in my existing Python code for storing calibration data.

Thanks all.
gerardvs
Posts: 102
Joined: Sunday 04 January 2015 0:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest-1
Location: /dev/null
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by gerardvs »

For input only switches I use a regular switch. From there you could change the desired type you want. E.g. a motion switch is **input** by design, or you could set protected to enabled to prevent accidentally push on the gui.
The sky is the limit :D
User avatar
waltervl
Posts: 7051
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by waltervl »

The answer I gave in the other topic that was already mentioned earlier ( viewtopic.php?f=28&t=45358 ) is still valid.
There is no simple data import function in Domoticz (luckily).

You can real time send sensor data to Domoticz with http API, MQTT, python plugins or the Domoticz Master/Remote principle.
waltervl wrote: Tuesday 24 November 2026 19:14
chrisisbd wrote: Tuesday 24 November 2026 17:42 Thank you, I think that's what I want to do.

Does "http API Call to a temperature device in Domoticz" mean that Domoticz would record the temperature (or whatever) reading and allow one to display and use it in Domoticz?
Yes.
You first need to create a temperature device manually (see wiki page https://wiki.domoticz.com/Dummy_for_virtual_Switches )
Then read the idx number of that device and use it in the API call.
When data is sent it is stored in the Domoticz database and you can use it for further analysis. Domoticz already creates nice graphs and reports out of the box through its user interface.
https://wiki.domoticz.com/Managing_Devices
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
willemd
Posts: 803
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.3
Location: The Netherlands
Contact:

Re: How to get 'local/internal' values into Domoticz

Post by willemd »

Here is an example from one of my python programs to update a power device. Just use the wiki to find the statement for the device that you need and run something similar from your remote system. You can also paste the URL in a browser to first check whether it works.

Code: Select all

domoticzIP="123.456.789.012"  # or whatever the domoticz IP address is
domoticzPort="8080"   
baseJSON="http://"+domoticzIP+":"+domoticzPort+"/json.htm?"
domoticzPort="8080"   

def updatePowerDevice(deviceIDX,power):
    try:
        apiCall="type=command&param=udevice&idx="+str(deviceIDX)+"&nvalue=0&svalue="+str(power)
        response=requests.get(baseJSON+apiCall)
        responseResult=str(response.json()["status"])
        if responseResult=="ERR":
            raise Exception
        else:
            responseResult=True
    except:
        print("ERROR: failed to update power device with IDX ",textIDX)
        print("Response was : ",response.json())
        responseResult=False
    return responseResult
Post Reply