I have a 24V battery which I monitor with a INA219 (Volt), I manually start the charger with a relais by a switch in domoticz.
Can anyone help me to make this action automatic?
For instance when the INA219 shows 23 Volt, -> activate the switch which starts the charger.
I use ESPEasy and a RPi as controller.
The voltage reading is a INA219 sensor connected to a ESP8266 with ESPEasy as software which measures voltage.
What I liked to have is for instance at 23 Volt it can activate an relais which is connected also to the ESP.
The relay works with the command:
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,0
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,1
(One for start and one for stop).
I read about rules in ESPEasy or Blockly in Domoticz and also there is a way with scripts.
I’am not familiar with these, maybe someone who can coach me?
Maybe somebody has a script which I maybe can modify to my wishes?
Regards
Script or Blockly for activate switch when battery is low
Moderator: leecollings
-
- Posts: 34
- Joined: Friday 17 June 2016 7:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spijkenisse
- Contact:
Script or Blockly for activate switch when battery is low
Last edited by NetEye on Sunday 19 August 2018 9:29, edited 1 time in total.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script or Blockly for activate switch when battery is low
How do you readout the batterylevel now ? Do you have a URL or domoticz sensor for that ?NetEye wrote: ↑Tuesday 14 August 2018 15:31 I have a 24V battery which I monitor with a INA219 (Volt), I manually start the charger with a relais by a switch in domoticz.
Can anyone help me to make this action automatic?
For instance when the INA219 shows 23 Volt, -> activate the switch which starts the charger.
I use ESPEasy and a RPi as controller.
Maybe somebody has a script which I maybe can modify to my wishes?
Regards
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 34
- Joined: Friday 17 June 2016 7:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spijkenisse
- Contact:
Re: Script or Blockly for activate switch when battery is low
Hallo waaren, thanks for your quick answer.
The voltage reading is a INA219 sensor connected to a ESP8266 with ESPEasy as software which measures voltage.
What I liked to have is for instance at 23 Volt it can activate an relais which is connected also to the ESP.
The relay works with the command:
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,0
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,1
(One for start and one for stop).
I read about rules in ESPEasy or Blockly in Domoticz and also there is a way with scripts.
I’am not familiar with these, maybe someone (you?) can coach me?
Hope I informed you complete?
Regards,
Jan
The voltage reading is a INA219 sensor connected to a ESP8266 with ESPEasy as software which measures voltage.
What I liked to have is for instance at 23 Volt it can activate an relais which is connected also to the ESP.
The relay works with the command:
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,0
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,1
(One for start and one for stop).
I read about rules in ESPEasy or Blockly in Domoticz and also there is a way with scripts.
I’am not familiar with these, maybe someone (you?) can coach me?
Hope I informed you complete?
Regards,
Jan
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script or Blockly for activate switch when battery is low
Some additional questions: do you see the voltage in domoticz and if so what is the name of that virtual voltage meter ?NetEye wrote: ↑Sunday 19 August 2018 9:16 The voltage reading is a INA219 sensor connected to a ESP8266 with ESPEasy as software which measures voltage.
The relay works with the command:
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,0
Http://<ESP IP adresss>/control?cmd=GPIO,<pin>,1
(One for start and one for stop).
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 34
- Joined: Friday 17 June 2016 7:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spijkenisse
- Contact:
Re: Script or Blockly for activate switch when battery is low
Dear waaren,
Yes I can see the voltage in domoticz on it’s own id nr and his name is: Licht accu
Regards
Jan
Yes I can see the voltage in domoticz on it’s own id nr and his name is: Licht accu
Regards
Jan
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script or Blockly for activate switch when battery is low
I hope I understand your requirements and setup correctly.
If not; please do not hesitate...
Look at the 10 lines Using dzVents with Domoticz for a short intro to dzVents and howto get this script active in domoticz.
Code: Select all
-- operateRelay.lua
return {
on = { timer = { "every 10 minutes" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "operateRelay" },
execute = function(dz)
-- Modify values below this line ----------
relaySwitch = dz.devices("relaySwitch") -- Name of your relaySwitch within quotes or idx without quotes
voltageSensor = dz.devices("Licht accu") -- Name of your voltageSensor within quotes or idx without quotes
lowVoltage = 23 -- below this value the switch will be turned on
highVoltage = 23.5 -- Above this value the switch will be turned off
hysteresisDelay = 10 -- Delay to prevent too frequent on/off actions
-- Modify values above this line ----------
if relaySwitch.lastUpdate.minutesAgo > hysteresisDelay then
if voltageSensor.voltage > highVoltage then
relaySwitch.switchOff().checkFirst()
elseif voltageSensor.voltage < lowVoltage then
relaySwitch.switchOff().checkFirst()
end
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 0 guests