Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Converting from OpenhB to HA

$
0
0

@Crumpy10 wrote:

Hello everyone,
First post here so go easy on me. So as the title may suggest I have come here from using OH for few years. I was mainly happy with it but I think I may be better off with HA, as long as I can get my head around the way it is configured. At this stage I have installed HASSIO on a pi3+ with SDimage and its up and running with one sonoff 4 channel discovered and using Tasmota. Apart from that it is bare with Samba, SH, Configurator, Mosquito running.

What I am trying to do first is get my head around how to configure the 4 channel pro first as this is used to control 2 way lighting (Called 3 way in the USA I believe) BUT also with Alexa control.
This is where I am stuck because in Openhab I had special items and rules defined because Alexa could not determine the physical state of the light. I also have a custom made arduino sensor with CT coils sensing when the lights are actually on and sending the state via MQTT to Openhab.

I suppose my questions are what is HA’s equivelant of Rules and Items in Openhab?

This is my wiring diagram of the lights (without the current sensing)-:

and my items file may make more sense than my ramblings-:

 //First 4 Channel Pro Sonoff for 2 way lighting

Switch Sonoff4ch_1Channel1 "Kitchen Lights" <light> (gLight) [ "Switchable" ] { mqtt="<[broker:arduino/channel1:state:default]", autoupdate="false" }
Switch Sonoff_relay1 "2-way switch" { mqtt=">[broker:cmnd/sonoff4chan_1/POWER1:command:*:default],<[broker:stat/sonoff4chan_1/POWER1:state:default]" } 

Switch Sonoff4ch_1Channel2 "Family Lights" <light> (gLight) [ "Switchable" ] { mqtt="<[broker:arduino/channel2:state:default]", autoupdate="false" }
Switch Sonoff_relay2 "2-way switch" { mqtt=">[broker:cmnd/sonoff4chan_1/POWER2:command:*:default],<[broker:stat/sonoff4chan_1/POWER2:state:default]" }

Switch Sonoff4ch_1Channel3 "Dining Lights" <light> (gLight) [ "Switchable" ] { mqtt="<[broker:arduino/channel3:state:default]", autoupdate="false" }
Switch Sonoff_relay3 "2-way switch" { mqtt=">[broker:cmnd/sonoff4chan_1/POWER3:command:*:default],<[broker:stat/sonoff4chan_1/POWER3:state:default]" }

Switch Sonoff4ch_1Channel4 "Office Lights" <light> (gLight) [ "Switchable" ] { mqtt="<[broker:arduino/channel4:state:default]", autoupdate="false" }
Switch Sonoff_relay4 "2-way switch" { mqtt=">[broker:cmnd/sonoff4chan_1/POWER4:command:*:default],<[broker:stat/sonoff4chan_1/POWER4:state:default]" }

and my rules-:

rule "Sonoff4ch_1Channel1 Toggle"
when
   Item Sonoff4ch_1Channel1 received command
then
   if (receivedCommand != Sonoff4ch_1Channel1.state) { 
          // only if new request does not match actual current state
          // then we need to toggle the relay state
      if (Sonoff_relay1.state == OFF) {
         Sonoff_relay1.sendCommand(ON)
      } else {
         Sonoff_relay1.sendCommand(OFF)
      }
   }  // else already in requested state
end

rule "Sonoff4ch_1Channel2 Toggle"
when
   Item Sonoff4ch_1Channel2 received command
then
   
   if (receivedCommand != Sonoff4ch_1Channel2.state) { 
          // only if new request does not match actual current state
          // then we need to toggle the relay state
      if (Sonoff_relay2.state == OFF) {
         Sonoff_relay2.sendCommand(ON)
      } else {
         Sonoff_relay2.sendCommand(OFF)
      }
   }  // else already in requested state
end

rule "Sonoff4ch_1Channel3 Toggle"
when
   Item Sonoff4ch_1Channel3 received command
then
   
      if (receivedCommand != Sonoff4ch_1Channel3.state) { 
          // only if new request does not match actual current state
          // then we need to toggle the relay state
      if (Sonoff_relay3.state == OFF) {
         Sonoff_relay3.sendCommand(ON)
      } else {
         Sonoff_relay3.sendCommand(OFF)
      }
   }  // else already in 
end

rule "Sonoff4ch_1Channel4 Toggle"
when
   Item Sonoff4ch_1Channel4 received command
then
   if (receivedCommand != Sonoff4ch_1Channel4.state) { 
          // only if new request does not match actual current state
          // then we need to toggle the relay state
      if (Sonoff_relay4.state == OFF) {
         Sonoff_relay4.sendCommand(ON)
      } else {
         Sonoff_relay4.sendCommand(OFF)
      }
   }  // else already in 
end

Any suggestions of where to start??

Cheers

Simon

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles