@mihamarkic@mastodon.social avatar

mihamarkic

@mihamarkic@mastodon.social

.net consultant, C# and recently also Kotlin and some Swift developer, ex C# MVP(2004-18), DevExpress MVP, LLBLGenPro Partner. Also tinkering with Kotlin and Jetpack Compose, Swift and SwiftUI, microcontrollers and 3D printing.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

juremes, to random Slovenian
@juremes@mastodon.social avatar

Tisto, ko ti postane jasno, da si zajebal, pa bi se vseeno rad našlepal na vlak "prvi iz skupine".

https://www.gov.si/novice/2024-05-22-izjava-predsednika-vlade-po-napovedi-voditeljev-spanije-irske-in-norveske-o-priznanju-palestine/

mihamarkic,
@mihamarkic@mastodon.social avatar

@juremes Haha sem isto pomislil, "ni še pravi čas", pa to.

bradwilson, to github
@bradwilson@mastodon.social avatar

How do I remove the button from 2022 17.10 menu bar?

mihamarkic,
@mihamarkic@mastodon.social avatar

@bradwilson My first thought as well after updating VS :)

tomi, to homeassistant

Link to the original blog post with a nice text/pictures layout.

The problem:

  • kids keep forgetting to carry the key to unlock the front door. They never forget to carry their phones though.

The solution:

  • unlocking the front door using a mobile phone

HW parts:

SW:

The process:

  1. I installed a wall box near the front door, under a nearby electrical socket (see below)
  2. When the company installed the front door, I asked them to install a UTP cable from the door lock mechanism to the socket.
  3. Bought the materials above (Aliexpress for the boards, Conrad for the power suppy).
  4. Connected the mains to the breaker (for emergency switch-off)
  5. Connected the cables from the breaker to the 24V power supply
  6. Connected the cables from the power supply to the ESP32 board, door solenoid relay and ESP32’s relay. Luckily, I didn’t need to install 5V power supply for the ESP board, because it also works with 24V.

Here’s the doodle of the connecting scheme:

doodle of the electrical schemeHere’s the original connecting scheme from Innotherm (door manufacturer), in Slovenian: It was useful because it reveals which power supply is appropriate (Meanwell MW HDR 30-24).

the electrical scheme for wiring the door unlocking mechanism7. Fitted everything in the wall box. It was too shallow! I couldn’t hide all the junk with the flat cover that came with a box.

Before fitting:

circuit breaker, power suppy and esp32 board hanging out of the wall boxEverything nicely fit in a box:

circuit breaker, power suppy and esp32 board nicely ft in the the wall box8. I designed and 3D printed a new cover in TinkerCad:

3d model of the wall box cover10. After a 3rd try (of 3D design and printing), all measures were finally correct and I could cover the box (Mastodon post):

wall box cover mounted11. Flashed ESP32 board with ESPHome*, added it to Home Assistant.

(*Actually it wasn’t that simple. The board doesn’t have a data USB connector. I had to buy USB2TTL adapter. I was bitching about it here.)

esp32 board with usb2ttl adapter connectedNevertheless, after the firmware update, I edited .yaml for the board so it exposes:

Main entity:

  • Switch (for controlling relay), connected to GPIO16

Misc. entities:

  • LED light (connected to GPIO 23, to signal when the door is opened)
  • Wifi sensor (for checking the power of Wifi signal, because the esp board is located in a wall box)
  • Uptime (to see the time since the last esp board reset)
  • Restart switch (to remotely restart the board if needed – but until now it wasn’t needed)

.yaml code for ESPHome (gathered from various websites, mainly from ESPHome):

... skipping the first part, wifi connectivity, substitutions etc.light:  - platform: status_led    name: "ESP32-rele01-vrata Led"    restore_mode: ALWAYS_OFF    pin:      number: GPIO23      inverted: Falseswitch:  - platform: gpio    pin: GPIO16    name: "Door lock switch"    inverted: False  # The following can be omitted  - platform: restart    name: ${devicename} restartsensor:  - platform: wifi_signal    name: ${devicename} wifi signal    update_interval: 600s  # human readable uptime sensor output to the text sensor above  - platform: uptime    name: ${devicename} Uptime in Days    id: uptime_sensor_days    update_interval: 60s    on_raw_value:      then:        - text_sensor.template.publish:            id: uptime_human            state: !lambda |-              int seconds = round(id(uptime_sensor_days).raw_state);              int days = seconds / (24 * 3600);              seconds = seconds % (24 * 3600);              int hours = seconds / 3600;              seconds = seconds % 3600;              int minutes = seconds /  60;              seconds = seconds % 60;              return (                (days ? String(days) + "d " : "") +                (hours ? String(hours) + "h " : "") +                (minutes ? String(minutes) + "m " : "") +                (String(seconds) + "s")              ).c_str();time:  - platform: homeassistant    id: homeassistant_time# Text sensors with general information.text_sensor:  # Expose ESPHome version as sensor.  - platform: version    name: $devicename Version  # Expose WiFi information as sensors.  - platform: wifi_info    ip_address:      name: $devicename IP    bssid:      name: $devicename BSSID  # human readable update text sensor from sensor:uptime  - platform: template    name: Uptime Human Readable    id: uptime_human    icon: mdi:clock-start    
  1. I’ve put an NFC sticker on the door.

  2. Wrote 2 simple automations that open a relay when the phone touches the NFC sticker and closes it after 1 second:

screenshot of the door unlock automation2nd automation switches the relay off after 1 second (also blinks the red status led on the ESP board):

screenshot of the door lock automation14. Added Aqara Door sensor to the door and connected it my existing Zigbee network using Zigbee2MQTT. It’s for logging when the door is open and for turning on the red status LED on the ESP32 board when the door is opened.

aqara door sensor mounted at the edge of the door15. Added a new control dashboard in Home Assistant for tracking what’s going on with the door:

dashboard in home assistant with various door statusesConclusion

After 6 months, it works great. Kids are satisfied and me too, because this is one of the first usable HomeAssistant projects that involve some electronics and physical devices. It works in 99% of cases.

There are some issues with it though:

  • The ESP32 board sometimes reboots after unlocking. It seems that the door solenoid relay draws too much current and the voltage from the power supply drops momentarily. Probably I need to add a capacitor to the board power input to smooth the voltage. This is not a big issue, because the board starts working normally after 3 or 4 seconds after the reboot.
  • Once or twice it happened the esp board relay got stuck in an OFF state. I had to hit it gently with a screwdriver to unstuck it. After that, I reduced the time the door solenoid is opened from 2 to 1 sec. Not sure if it will help. Maybe it’s just a bad relay.
  • Several times the wifi was down and the board couldn’t communicate with the Home Assistant. It looks like my telco provider’s router is not the best one and it freezes sometimes. Probably I need to buy a better wifi router.

TODO

I have several ideas on how to upgrade the unlocking mechanism:

  • unlocking with a fingerprint
  • unlocking with facial recognition

Disclaimer

The links to the products are not affiliate links and I don’t receive any compensation for linking.

The code and the ideas are mostly from HomeAssistant and ESPHome community forums.

https://blog.rozman.info/unlocking-the-front-door-using-the-mobile-phone-and-home-assistant/

doodle of the electrical scheme
the electrical scheme for wiring the door unlocking mechanism

mihamarkic,
@mihamarkic@mastodon.social avatar

@jkmcnk @tomi ^^^ socialni inženiring v praksi 🤪

mihamarkic, to Israel
@mihamarkic@mastodon.social avatar

Oh, no, didn't win the contest. This is peak antisemitism! /s

mihamarkic, to stackoverflow
@mihamarkic@mastodon.social avatar

So the continues with . What would be an alternative?

smallcircles, to random
@smallcircles@social.coop avatar

tom's HARDWARE: Cookies?

me: No!

tom's HARDWARE: Yess. Cookies!

(Note to self: Should avoid @tomshardware site next time)

mihamarkic,
@mihamarkic@mastodon.social avatar

@smallcircles @tomshardware Use container, problem solved. Though somebody might report them to EU GDPR watcher.

po3mah, to random
@po3mah@mastodon.social avatar

Today I soldered the tiniest thing ever. This resistor (red circle) is 0.8mm long.
Who designed this s**t?
(it's for selecting internal-external antenna)

You don't want to see my burned fingers.

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah That's lame. Real men solder big resistors, not this tiny crap.

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah Outdoor camera?

dreamykeaver, to linux
@dreamykeaver@chitter.xyz avatar

Are there reasons why C# is not used much for software ?

Can someone explains me I'm genuinely confused. I haven't heard of Mono a while ago.

mihamarkic,
@mihamarkic@mastodon.social avatar
mihamarkic,
@mihamarkic@mastodon.social avatar

@khalidabuhakmeh @rockylhotka @dreamykeaver @wagemakers @avaloniaui Is Jetpack Compose or Swift(UI?) any different though?

po3mah, to 3DPrinting
@po3mah@mastodon.social avatar

Fingers crossed.

mihamarkic, (edited )
@mihamarkic@mastodon.social avatar

@po3mah @Ermin Luštno, avtor omenja 2 dni. S čim tiskaš?

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin Avantura takorekoč

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin Kaj luno tiskaš z belo barvo?

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin in to kar brez podpore 💪

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin Moram prav poskušati ob priliki

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin V štirih dneh prideš na Luno.

mihamarkic,
@mihamarkic@mastodon.social avatar

@po3mah @Ermin Si pogledal, če se vidi pristanek Apolla? Ker vemo, da je laž :D

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • mdbf
  • Youngstown
  • cisconetworking
  • slotface
  • rosin
  • thenastyranch
  • ngwrru68w68
  • khanakhh
  • megavids
  • ethstaker
  • tacticalgear
  • modclub
  • cubers
  • Leos
  • everett
  • GTA5RPClips
  • Durango
  • anitta
  • normalnudes
  • provamag3
  • tester
  • lostlight
  • All magazines