logo elektroda
logo elektroda
X
logo elektroda

Transmission of readings + calculations to the virtual sensor.

ojciec81 666 9
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19885919
    ojciec81
    Level 10  
    Hello

    I need the data from a sensor that measures, for example, the generated energy from photovoltaic panels to be passed along with the calculations to another virtual sensor.



    Please make a suggestion.

    THANK YOU
  • ADVERTISEMENT
  • #2 19886006
    gkwiatkowski
    CCTV and Stationary Alarms specialist
    You need to use a data relay. )


    What is the data interface from the measuring sensor?
    What is the transmission method? Wired or wireless?
    What is a virtual sensor?
  • ADVERTISEMENT
  • #3 19952923
    ojciec81
    Level 10  
    Thanks for your reply. Sorry I'm only writing back now.
    Can you hint more about the data relay.
    The sensors are virtual and the transmission is waterless.

    What do you have in mind?
    gkwiatkowski wrote:
    What is the data interface from the measuring sensor?
    .
  • ADVERTISEMENT
  • #4 19952979
    gkwiatkowski
    CCTV and Stationary Alarms specialist
    ojciec81 wrote:
    Thanks for your reply. Sorry that I am only writing back now.
    Can you hint more about the data relay.
    The sensors are virtual and the transmission is waterless.

    What do you have in mind?
    gkwiatkowski wrote:
    What is the data interface from the measuring sensor?
    .

    Describe in more detail what is meant by a virtual sensor.
  • #5 19974310
    xury
    Automation specialist
    Essential question what sensor what system? Fairies on the electrode have a ban :)
  • #6 19974857
    ojciec81
    Level 10  
    The system is Domoticz.

    In general, my idea is to create a script that calculates how much energy from photovoltaic production remains to be used.

    Energy sent to the grid x 0.8 - energy taken from the grid, over a period of 24 months.

    Transmission of readings + calculations to the virtual sensor. .

    Transmission of readings + calculations to the virtual sensor. .
  • #7 19976674
    xury
    Automation specialist
    You create a virtual sensor and dzvents script in events. You'll find a link to an example in my signature.

    Added after 9 [hours] 34 [minutes]: .

    While this won't be in a two-year period, it should work
    Code: Lua
    Log in, to see the code
    .
    I am not sure of the sensor chosen for the stock. I was writing quickly without checking. You'll have to experiment for yourself
  • #8 19982871
    ojciec81
    Level 10  
    Thank you very much
    I will check it out today.
  • ADVERTISEMENT
  • #9 19986935
    ojciec81
    Level 10  
    Hello

    After entering the code I received this error :

    2022-04-20 18:12:18.368 Error: dzVents: Error: (3.1.8) .../pi/domoticz/scripts/dzVents/generated_scripts/E_Mag.lua:9: attempt to perform arithmetic on a table value
    2022-04-20 18:12:19.299 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler E_Mag
  • #10 20183816
    ojciec81
    Level 10  
    Please advise what is causing the error
    
    return {
    
    	return {
    
    	on = {
    	    devices = {'Fronius - TO_GRID'}
    	    },
    	
    	execute = function(domoticz, item)
    	    
    	    local togrid = (domoticz.devices('Fronius - TO_GRID')*0.8)  -- do sieci *0.8
    		local fromgrid = tonumber(domoticz.devices('Fronius - FROM_GRID'))  -- z sieci
    	    local storage = fromgid-togrid
    	    local licznik = tonumber(domoticz.devices('Mag').state)  -- utworzyć wirtualny czujnik rfx meter counter o nazwie w apostrofach  np. 'Magazyn'
    	    local ecounter = domoticz.devices('Mag') 
    	    licznik.updateCounter(storage.WhTotal)
    	    
    	end
    	
    }

    error:

    pi/domoticz/scripts/dzVents/generated_scripts/E_Mag.lua:10: attempt to perform arithmetic on a table value

Topic summary

The discussion revolves around transmitting data from a sensor measuring energy generated by photovoltaic panels to a virtual sensor within the Domoticz system. Users inquire about the implementation of a data relay and the specifics of virtual sensors. A script is proposed to calculate the energy balance based on the energy sent to and taken from the grid, with examples provided for coding in dzVents. Errors encountered during script execution are also addressed, focusing on arithmetic operations involving device states and ensuring proper data types are used.
Summary generated by the language model.
ADVERTISEMENT