Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcio Granzotto Rodrigues marciogranzotto

View GitHub Profile
View zigbee2mqtt_aqara_wireless_switch.yaml
blueprint:
name: Aqara Wireless Switch (single, double, hold)
description: 'Control anything using Aqara Wireless Switch.
Customizable actions for each press.
This version of the blueprint is for buttons supporting single, double and hold actions.
'
domain: automation
@marciogranzotto
marciogranzotto / sync_lights.yaml
Created Dec 25, 2021
Home Assistant Automation Blueprint for syncing the states of two lights
View sync_lights.yaml
blueprint:
name: Sync two lights
description: Turn on a light when other one is turend on and vice versa
domain: automation
input:
light_entity1:
name: Light 1
selector:
entity:
domain: light
@marciogranzotto
marciogranzotto / Flow Node-RED Display Wemos.md
Last active Nov 21, 2020
Flow do Node-RED que uso pra mostrar minha glicemia, e outras infos, no meu display Wemos Lolin32
View Flow Node-RED Display Wemos.md

[{"id":"3e727e47.c13612","type":"subflow","name":"1 USD to BRL","info":"","category":"","in":[{"x":280,"y":320,"wires":[{"id":"6ca501bf.1854a"}]}],"out":[{"x":820,"y":320,"wires":[{"id":"f5176590.468c78","port":0}]}],"env":[],"color":"#3FADB5","outputLabels":["Dolar value"],"icon":"font-awesome/fa-money"},{"id":"f5176590.468c78","type":"function","z":"3e727e47.c13612","name":"parse dolar value","func":"function getMatches(string, regex, index) {\n  index || (index = 1); // default to the first capturing group\n  var matches = [];\n  var match;\n  while (match = regex.exec(string)) {\n    matches.push(match[index]);\n  }\n  return matches;\n}\n\n\nvar regex = /(\\d\\,\\d\\d) Real brasileiro/g\nvar
View switch.yaml
substitutions:
devicename: nome_do_nodo
ss_id: "Nome da Wifi"
pass: "Senha da Wifi"
switch4: "Nome switch4"
light_1: "Nome Luz1"
light_2: "Nome Luz2"
light_3: "Nome Luz3"
esphome:
name: ${devicename}
View NX-SM400 Teardown & Tasmota pt-BR.md

NX-SM400

Essa é a versão em português

For the English (en-US) version check THIS LINK

A algum tempo, alguns modelos de smart plug com o padrão de tomada brasileiro começaram a aprecer no AliExpress.

View NX-SM400 Teardown & Tasmota.md

NX-SM400

This is the english version

Para a versão em português (pr-BR) use ESSE LINK

Recently, some smart plugs with the BR plug type started appearing on AliExpress

@marciogranzotto
marciogranzotto / backup.sh
Last active Apr 30, 2018 — forked from fragolinux/backup.sh
simple but effective node-red setup backup script
View backup.sh
#!/bin/bash
cd
# useful vars
DATE=$(date +"%Y%m%d%H%M")
WHERE=~/backup/$DATE
# create dated backup folders
mkdir -p $WHERE/{sqlite,nodered,etc}
# safely backup sqlite db
# sqlite3 ~/dbs/iot.db ".backup $WHERE/sqlite/iot.db"
# backup json and js files
@marciogranzotto
marciogranzotto / KotlinContracts.kt
Last active Aug 7, 2017
File template for Android Studio that creates the contracts for a new VIPER module
View KotlinContracts.kt
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
#end
#parse("File Header.java")
object ${NAME} {
interface View: BaseContracts.View {
//TODO
}
View VIPER vs VIPE.kt
class LoginContracts {
interface View {
fun showError(message: String)
//fun presentHomeScreen(user: User) <- This is no longer a part of the View's responsibilities
}
interface Router {
fun presentHomeScreen(user: User) // Now the router handles it
}
}
@marciogranzotto
marciogranzotto / VIPER Android Example.kt
Last active Apr 16, 2021
This is an example of Android development with VIPER in Kotlin
View VIPER Android Example.kt
interface LoginContracts {
interface View {
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}