—————————————————————————————————————————

                   Special April Sale Discounts!!

Special Spring Sale discounts for all the products available on Tindie Store:
https://www.tindie.com/stores/nEXT_EVO1/

Including the popular MPDMv4 Universal AC Mains Dimmer and the MPRSx8 Home Automation Board!

Spread the word and use Coupon code: NDSCVO10

Thank you all for your support!

 —————————————————————————————————————————

Part 2 of the tutorial: Raspberry Pi + Domoticz + MPDM v4 AC dimmer board.

Today topic: Domoticz setup & final testing :





What we will need:
MPDMv4 Universal AC Dimmer – available also on Tindie Store !
Raspberry PI 2 Board
– PIGPIO library for Raspberry PI  – take a look at Part 1 how to install and test
Domoticz
Latest available, on a Raspberry PI 2 Board install :  
     sudo curl -L install.domoticz.com | bash


Software 

Domoticz LUA script for RPi Dimmer:

commandArray = {}
DomDevice = 'RPi_Dimmer';
if devicechanged[DomDevice] then
   if(devicechanged[DomDevice]=='Off') then
     print ("OFF dimm = "..uservariables['dimm']);
     CalcValue = 860*1000;
   else if(devicechanged[DomDevice]=='On') then
        DomValue = uservariables['dimm'];
        print ("ON dimm = "..uservariables['dimm']);
        CalcValue = DomValue;
      else
         print("Other");
         DomValue = otherdevices_svalues[DomDevice];
         CalcValue = (900-(DomValue*9))*1000;
         commandArray['Variable:dimm'] = tostring(CalcValue);
--         commandArray['Variable:dimm'] = CalcValue;
         print ("dimm Level = "..uservariables['dimm']);
   end
   end
   runcommand = "pigs hp 18 400 " ..tonumber(CalcValue);
   print("PWM calculated value= "..CalcValue);
   print("Run command: " ..runcommand);
   os.execute(runcommand);
end
return commandArray

Save it as script_device_RPi_Dimmer.lua in the domoticz/scripts/luafolder !


————————————————— DISCLAIMER ————————————————–
      WARNING!! You will play with LIVE MAINS!! Deadly zone!! 
      If you don’t have any experience and are not qualified for working with MAINS power I will not encourage you to play arround!. The author take no responsibility for any injury or death resulting, directly or indirectly, from your inability to appreciate the hazards of household mains voltages.
   The circuit diagrams are as accurately as possible, but are offered with no guarantees whatsoever. 
    There is no guarantee that this design meets any Rules which may be in force in your country so please check before your local rules/regulations.
—————————————————————————————————————————-
 

Creative Commons License

All materials and boards released under ESP8266-Projects.com are licensed under a Creative Commons Attribution-NonCommercial 4.0 International License 


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

AC Dimmer

MPDMv7.5 Arduino IDE driver example

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard is also available on Tindie Store A very simple MPDMv7.5 Arduino IDE driver Read more…

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 – Part 3 – DAC

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard ESP Basic program example for the Extra DAC version configuration: address = 96 Read more…

AC Dimmer

AC Dimmer DevBoard – MPDMv7.5 – Part 2

For a more detailed description please take a look at the Part 1: MPDMv7.5 AC Dimmer devboard overview MPDMv7.5 AC Dimmer devboard ESP Basic program example for the basic version configuration: 'write("starttimer",10) cls 'VCNT GPIO Read more…