środa, 19 lutego 2020

Control Sony Bravia TV with openHAB 2.5 through Google Home

Here is how i control power on and off my sony bravia tv :)

1. Download two files (print_ircc_codes.sh; send_command.sh) from:
https://github.com/breunigs/bravia-auth-and-remote
and save them in /home/pi folder with attributes 0755.

2. Set your tv like in readme.md:

  • Navigate to: [Settings] → [Network] → [Home Network Setup] → [IP Control]
  • Set [Authentication] to [Normal and Pre-Shared Key]
  • There should be a new menu entry [Pre-Shared Key]. Set it to 0000. If you choose anything else, you need to change the PSK in the send_command.sh script.


3. Run this command to check control codes of your tv.
(of course with your tv ip)
print_ircc_codes.sh 192.168.8.120
4. Now create openhab files openHAB:
(of course edit tv codes)

sony.items
Switch TV "Bravia TV" { ga="Switch" }

sony.sitemap
sitemap default label="Dom"
{
Switch item=TV label="Bravia TV" mappings=[ "ON"="ON", "OFF"="OFF" ]
}

sony.rules
rule "TV ON"
when
Item TV received command ON or
Item TV changed from OFF to ON
then
executeCommandLine("/home/pi/send_command.sh 192.168.8.120 AAAAAQAAAAEAAAAuAw== sony")
end

rule "TV OFF"
when
Item TV received command OFF or
Item TV changed from ON to OFF
then
executeCommandLine("/home/pi/send_command.sh 192.168.8.120 AAAAAQAAAAEAAAAvAw== sony")
end

poniedziałek, 17 lutego 2020

Setup openHAB 2.5 + Mosquitto MQTT + SONOFF ESPurna + Google Home

Since gbridge.io is shutting down i needed to move to different platform.
openHAB cloud started to be stable so it's good time to move my smart home to it.

This is fast tutorial and does not explains everything exactly, serves only to facilitate the work of a person who knows a little about it :)

1. First install Mosquitto server on your raspberry. It's way more stable than openHAB Moquette broker.
sudo apt-get install mosquitto mosquitto-clients
2. Then install newest stable openHAB
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
sudo apt-get install apt-transport-https

echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list

sudo apt-get update
sudo apt-get install openhab2

sudo systemctl start openhab2.service
sudo systemctl status openhab2.service

sudo systemctl daemon-reload
sudo systemctl enable openhab2.service
3. In openHAB install MQTT Binding addon and openHAB Cloud Connector

4. Create config files for your SONOFF's:
(off course with your mqtt names)

/etc/openhab2/items/default.items
Switch BedTV "Bed TV" { channel="mqtt:topic:BedTV:switch", ga="Outlet"}
Switch BedLight "Bed Light" { channel="mqtt:topic:BedLight:switch", ga="Light"}

/etc/openhab2/sitemap/default.sitemap
sitemap default label="Dom"
{
     Switch item=BedTV label="Bed TV"
     Switch item=BedLight label="Bed Light"
}

/etc/openhab2/things/default.things
Bridge mqtt:broker:myUnsecureBroker "Mosquitto MQTT Broker" [ host="localhost", secure=false ]
{
     // Bed TV
     Thing mqtt:topic:BedTV "Bed TV" {
          Channels:
          Type switch : switch "Power Switch" [
          stateTopic="ESPURNA-Bed-TV/relay/0",
          commandTopic="ESPURNA-Bed-TV/relay/0/set",
          on="1",
          off="0"
          ]
     } 
     // Bed Light
     Thing mqtt:topic:BedLight "Bed Light" {
          Channels:
          Type switch : switch "Power Switch" [
          stateTopic="ESPURNA-Bed-Light/relay/0",
          commandTopic="ESPURNA-Bed-Light/relay/0/set",
          on="1",
          off="0"
          ]     }
}

5. Configure your SONOFF ESPurna to connect to your MQTT Mosquitto server.
(i like ESPurna soft becouse for me it's way more stable that Tasmota)
6. Configure openHAB Cloud Connector
cat /var/lib/openhab2/uuid ; echo
cat /var/lib/openhab2/openhabcloud/secret ; echo

6.1 Create account with this data on https://myopenhab.org/

6.2 Add openHAB on your phone in your google assistant.




czwartek, 7 lutego 2019

Alternatywnego Podłączenie Włącznika Ściennego Sonoff Touch


gbridge.io with Tasmota or ESPURNA and Mosquitto Bridge on Raspberry

Oto poradnik jak skonfigurować usługę gbridge.io by działała z przełącznikim SONOFF z wgranym TASMOTA albo ESPURNA z wykorzystaniem serwera bramki MQTT na raspberry.
gbridge.io pozwala na podłączenie urządzeń które obsługują MQTT np. SONOFF do google home.

1. Install Mosquito newest version on your RPI:

sudo apt update 
sudo apt install -y mosquitto mosquitto-clients 
sudo systemctl enable mosquitto.service

2. Edit /etc/mosquitto/mosquitto.conf adding at the end:

TASMOTA
connection gbridge-io
address mqtt.gbridge.io:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv311
cleansession true
remote_username {gbridge-mqtt-username}
remote_password {gbridge-mqtt-password}
remote_clientid gbridge-u{userid}-{randomstring}
topic gBridge/u{uid}/cmnd/+/power both 0 "" ""
topic gBridge/u{uid}/stat/+/POWER both 0 "" ""
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2

ESPURNA
connection gbridge-io
address mqtt.gbridge.io:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv31
cleansession true
remote_username {gbridge-mqtt-username}
remote_password {gbridge-mqtt-password}
remote_clientid gbridge-u{userid}-{randomstring}
topic gBridge/u{uid}/+/relay/0/set both 0 "" ""
topic gBridge/u{uid}/+/status both 0 "" ""
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2
3. Reboot Mosquitto
sudo /etc/init.d/mosquitto restart
4. Configure MQTT settings

TASMOTA


ESPURNA

4. Add Device on https://gbridge.kappelt.net/device


TASMOTA

ESPURNA
5. Connect gbridge.io with your google home and it's done :)

Szybka Pita z Patelni + tzatziki

Przepis na pitę pochodzi od Karola Okrasy :). Jest bardzo szybka w wykonaniu i o niebo lepsza niż ta ze sklepu gotowa pakowana.



Składniki na 4 pity:
  • mąka pszenna – 200 g
  • jogurt – 110 ml
  • oliwa – 2 łyżki
  • proszek do pieczenia – 0,5 łyżeczki
  • sól
Składniki na sos tzatziki:
  • 2 ogórki
  • 400 g jogurtu greckiego
  • PRYMAT Przyprawa Tzatziki
    lub 
  • 1/2 ząbka czosnku, sól, świeżo zmielony czarny pieprz, 1 łyżeczka oliwy
Przygotowanie :)
  1. Wszystkie składniki umieszczamy w misce i  mieszamy wyrabiamy ciasto na desce oprószonej mąką. 
  2. Ciasto smarujemy oliwą i przekładamy do miski którą przykrywamy folią spożywczą i wkładamy do lodówki na 10 minut. 
  3. Ciasto kroimy w równe 4 plastry i rozwałkowujemy na grubość ok. 0,5 cm. 
  4. Patelnię rozgrzewamy. Chlebki smażymy na patelni na złoty kolor z obu stron.
  5. Ogórki ścieramy na tarce, dodajemy jogurt i przyprawę i mieszamy.


Źródła:
https://kuchnialidla.pl/gyros-z-jagnieciny-z-chlebkiem-pita