Import Electric data to domoticz electric(instant+counter)

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
naeblizz
Posts: 3
Joined: Wednesday 01 August 2018 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Import Electric data to domoticz electric(instant+counter)

Post by naeblizz »

Hi . I am trying to import sensor data, electricity reading from node red to domoticz. Right now I have 2 dummy sensors general purpose which recives mqtt data from node red to display instant energy consumption and energy counter . This works fine, my problem now is that I am trying to merge those 2 values to 1 dummy sensor "electric(instant+counter)" . I can't seem to get the mqtt syntax right because I get no value on the new sensor when trying to send data. This is what I send to domoticz/in from node red with my general purpose sensor :
{ "idx" : 5041, "nvalue" : {{payload}}, "svalue" : "{{payload}}" }
Im trying to send the same to the electric dummy sensor but I get no value on that one. Anyone knew what I am doing wrong ?

//Mikael
naeblizz
Posts: 3
Joined: Wednesday 01 August 2018 20:38
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by naeblizz »

I got it working . tnx anyway
User avatar
JustDude
Posts: 16
Joined: Thursday 23 February 2023 18:15
Target OS: Linux
Domoticz version: Latest
Location: NL
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by JustDude »

I just had the same question,,, looking for the right value to store the value from Node-red.
I tried svalue, usage, consumed. Nothing works as I would expect.
Is there a datamodel or approach on where to find the correct way?

By the way: Would be nice if you know the solution to let (me) us and other readers know 8-)
---
Measuring is knowing
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by waltervl »

There is a node-red subforum here : https://domoticz.com/forum/viewforum.php?f=81

The mqtt message should have the right mqtt format. Are you already able to update the sensor by sending an mqtt message manual?
See wiki https://www.domoticz.com/wiki/MQTT#MQTT_to_Domoticz

Edit: Electric

The electric sensor will show the current usage of electricity in Watt and the cumulative usage in kWh. You can add digits after the decimal if needed.

Code: Select all

{"command":"udevice", "idx":1234, "svalue":"us;cu"}
where us is usage in Watt and cu is cumulative usage in Wh (even though it is displayed in kWh)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
JustDude
Posts: 16
Joined: Thursday 23 February 2023 18:15
Target OS: Linux
Domoticz version: Latest
Location: NL
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by JustDude »

Thanks that helped. Found the Node-red subforum also.
---
Measuring is knowing
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by averter »

Hi,

I am trying to do something similar. I've created an instantaneous electric virtual device and want to replace it with an electric (instant + counter) type, but the "instant + counter" device is not listed in the new device drop down menu from the "instantaneous" device. Is there any simple workaround? Thank you in advance.

Averter
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by FireWizard »

Hello @averter,

You said:
I've created an instantaneous electric virtual device
I have no idea where and what you have created, being "an instantaneous electric virtual device".
Can you give more details?

I think, that you should create in "Hardware" a "Dummy (Does nothing, use for virtual switches only)".
After that you click "Create Virtual Sensors" and select "Electric (Instant + Counter)".

I think that is what you need.

Regards
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by averter »

Hello @FireWizard,

Thanks and apologies for not being clear. I have one dummy hardware device and have created a virtual sensor of the type "usage (electric)": this is what I mean by instantaneous electric virtual device. It works fine, but it doesn't include an energy counter in kWh, only the kW instantaneous reading, hence why I would like to transfer its log to another virtual sensor of the type "electric (instant + counter)".
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by willemd »

Is the kWh device set to "computed" or "from device" (using the edit button) ?
If set to computed, then domoticz will calculate the energy from the instantaneous values.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by FireWizard »

Hi @averter,

Sorry, that I did not understand your own naming of a virtual "Usage" sensor.
I have one dummy hardware device and have created a virtual sensor of the type "usage (electric)": this is what I mean by instantaneous electric virtual device. It works fine, but it doesn't include an energy counter in kWh, only the kW instantaneous reading
A virtual sensor of the type "Usage" will show you the actual usage in Watt and not the Consumed or Produced Energy.
Therefore you need a sensor of the type: "Electric (Instant + Counter)". but you have to upload also the cumulative usage in Wh.

But, as far as I know, to replace an old sensor for a new one, both have to be of the same type. However this is not the case, so I cannot guarantee any success.

Regards
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by averter »

willemd wrote: Thursday 17 August 2023 22:12 Is the kWh device set to "computed" or "from device" (using the edit button) ?
If set to computed, then domoticz will calculate the energy from the instantaneous values.
Thanks for letting me know about that option, but my question sort of remains the same. How can I transfer all the instantaneous values from the "usage (electric)" device to the new "electric (instant + counter)" device? Thanks
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by averter »

FireWizard wrote: Thursday 17 August 2023 22:19 Hi @averter,

Sorry, that I did not understand your own naming of a virtual "Usage" sensor.
I have one dummy hardware device and have created a virtual sensor of the type "usage (electric)": this is what I mean by instantaneous electric virtual device. It works fine, but it doesn't include an energy counter in kWh, only the kW instantaneous reading
A virtual sensor of the type "Usage" will show you the actual usage in Watt and not the Consumed or Produced Energy.
Therefore you need a sensor of the type: "Electric (Instant + Counter)". but you have to upload also the cumulative usage in Wh.

But, as far as I know, to replace an old sensor for a new one, both have to be of the same type. However this is not the case, so I cannot guarantee any success.

Regards
According to the previous reply from willemd it should be possible to calculate the cumulative usages by setting the "computed" instead of "from device" option in the Electric (Instant + Counter)" device, which would sort of make these two sensors equivalent?
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by FireWizard »

@averter,

You can try, but I never did that.

What @willemd said is correct, but he did not say, that you can replace two different type of sensors with each other.

Regards
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by willemd »

Indeed, I don't know about transferring data between sensors. I would look into the database see which tables are used for the various sensors, how the structure is and then use sqlite to do a transfer (after first making a backup). Not an easy answer. Maybe there are other options.
averter
Posts: 39
Joined: Thursday 24 February 2022 8:32
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Import Electric data to domoticz electric(instant+counter)

Post by averter »

willemd wrote: Friday 18 August 2023 22:11 Indeed, I don't know about transferring data between sensors. I would look into the database see which tables are used for the various sensors, how the structure is and then use sqlite to do a transfer (after first making a backup). Not an easy answer. Maybe there are other options.
Yes, sqlite is probably my best bet. I'll give it a go after my next backup. Thanks both! ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest