JSON API - Create device with EnergyMeterMode and external Id

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
ghulleman
Posts: 9
Joined: Sunday 16 June 2019 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands / Hilversum
Contact:

JSON API - Create device with EnergyMeterMode and external Id

Post by ghulleman »

Hi All,

Regarding the Create device option of the JSON API (https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s)

Is it somehow possible to set:
- An externe device Id (preferable one that can be used to udevice/update the measurement from external).
- Set the 'EnergyMeterMode' to computed for the "Electricity (instant and counter)" device upon create / update if afterwards?

Reason is that I am trying to integrate plugwise circles with this system anno 2019. Yes, I am aware of the other post (https://www.domoticz.com/forum/viewtopi ... =14&t=7420) but I am creating/modifying the node-red / MQTT solution for a standard installation. The plugwise circles have their own ids (7 chars). Also, I want domoticz to calculate the energy used based on the power measurements and the sensors to be created automatically.

Gerrit
pjwschram
Posts: 2
Joined: Tuesday 08 February 2022 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: JSON API - Create device with EnergyMeterMode and external Id

Post by pjwschram »

Hi,

I've been struggling with the exact same thing. I have a Node-Red script that creates the Device for the plugwise circle. This is done however with an DeviceID (I don't mean the IDX) that has been chosen by Domoticz. Then I want to find the device in the next update of the device, so I need so sort of reference to the created device. It seems only the name works.

I tried updating the Description, EnergyMeterMode and related items, but it doesn't seem to work. I used this JSON, which is used by the UI of Domoticz, but when running the http call from the browser it will not adjust the Description or the EnergyMeterMode.

http://192.168.178.8:8080/json.htm?type ... 4567_power[/b]&switchtype=0&EnergyMeterMode=1&customimage=0&used=true

Does anyone know if it is possible to update the setting for DeviceID, Description and/or EnergyMeterMode?
User avatar
waltervl
Posts: 5154
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: JSON API - Create device with EnergyMeterMode and external Id

Post by waltervl »

I tested it with one of my test devices and I could change the EnergyMeterMode setting 1 (computed) 0 (from device) and description.
Be aware that you have to refresh the Utility page (F5) to see the change!
I do not think it is possible to change the deviceID

Code: Select all

https://127.0.0.1/json.htm?type=setused&idx=85&name=Omnik%20-%20Inverter%20(kWh)&description=Test%20Description&switchtype=0&EnergyMeterMode=1&customimage=0&used=true
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
pjwschram
Posts: 2
Joined: Tuesday 08 February 2022 19:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: JSON API - Create device with EnergyMeterMode and external Id

Post by pjwschram »

Hmmm, refresh first. That makes sense. Whoopsie, that would be kinda dumb not to have tried that. Will try it out, that would make life much easier.

Update: Indeed it works for both the description and the EnergyMeterMode. So I can use the description field to contain the mac-address of the Plugwise Circle and use that to find the IDX of the device in Node-Red. The user can then rename the device to whatever he wants and still keep the link between Plugwise and Domoticz alive.

Although a way to update/adjust the Device-ID would be great, because that would be the proper way to align the Plugwise configuration and Domoticz properly.
User avatar
waltervl
Posts: 5154
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: JSON API - Create device with EnergyMeterMode and external Id

Post by waltervl »

There are 2 ways to make a proper hardware integration that can handle this: C++ https://www.domoticz.com/wiki/Developin ... are_plugin or Python Plugin Framework https://www.domoticz.com/wiki/Developin ... hon_plugin
If the hardware supports MQTT Autodiscover it is also possible to use that.
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: No registered users and 1 guest