Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example for ISKRA MT174 #9

Merged
merged 2 commits into from
Mar 13, 2023
Merged

add example for ISKRA MT174 #9

merged 2 commits into from
Mar 13, 2023

Conversation

mampfes
Copy link
Owner

@mampfes mampfes commented Feb 23, 2023

@zibous Could you please check if I copied your example correctly? I tried to copied only the really necessary stuff.

@zibous
Copy link

zibous commented Feb 24, 2023

@mampfes

This is missing:

## ---------------------------------------------------
# Serial interface uart 
# board: "az-delivery-devkit-v4"
## ---------------------------------------------------
uart:
  id: my_uart
  tx_pin: GPIO17 # orange
  rx_pin: GPIO16 # white
  baud_rate: 300
  data_bits: 7
  parity: EVEN
  stop_bits: 1

obis_d0:
  - id: my_sm
    uart_id: my_uart


## ---------------------------------------------------
# the device need to be triggered to sending data. 
# We can use the integrated "interval" component 
# send the command: 2F3F210D0A ('/?!\r\n')
# see: https://github.com/jplitza/esphome_components  
## ---------------------------------------------------
interval:
  - interval: 60sec
    then:
      - logger.log: "Init reading data for ${device_name_short}"
      - uart.write:
          id: my_uart
          data: [0x2F, 0x3F, 0x21, 0x0D, 0x0A]

mt174

Protokoll is:

# ---------------------------------------------------
# Testcase protocoll for ISk5MT174
#  MT174-D1A52-G22-M3K0
# ---------------------------------------------------
# serial port read data d2 protocoll for ISk5MT174
# /ISk5MT174-0001               Start Telegram / and Device Name
# 0.9.1(130203)                 Current time (hh:mm:ss)
# 0.9.2(0230223)                Date (1YY.MM.DD)
# 0.0.0(00339188)               *Device address 1
# 0.2.0(1.03)                   *Firmware version
# C.1.6(FDF5)                   *Firmware check sum
# 1.8.1(0011404.409*kWh)        Positive active energy (A+) in tariff NT [kWh]
# 1.8.2(0023813.725*kWh)        Positive active energy (A+) in tariff HT [kWh]
# 2.8.1(0015608.962*kWh)        Negative active energy (A-) in tariff T1 [kWh]
# 2.8.2(0000900.569*kWh)        Negative active energy (A-) in tariff T2 [kWh]
# F.F.0(0000000)
# !                             End of telegram

What i am missing:

  • decode Devicename as textsensor
  • Event End of telegram to execute a script.

Simple python script to get the data from a weidman IR Schreib/Lesekopf USB (Optokopf):

#!/usr/bin/env python3
import serial
import time

## ls -l /dev/serial/{by-path,by-id}/*
## lrwxrwxrwx 1 root root 13 Jul  2 13:33 /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_D307N80T-if00-port0 -> ../../ttyUSB0
## lrwxrwxrwx 1 root root 13 Jul  2 13:33 /dev/serial/by-path/pci-0000:00:14.0-usb-0:5:1.0-port0 -> ../../ttyUSB0

## dmesg | grep tty
## [534356.058130] usb 2-5: FTDI USB Serial Device converter now attached to ttyUSB0
SERIALPORT = "/dev/ttyUSB0"
BAUDRATE = 300
ser = serial.Serial(SERIALPORT, BAUDRATE, serial.SEVENBITS, serial.PARITY_EVEN)
ser.write(b"\x2F\x3F\x21\x0D\x0A")
time.sleep(0.5)
numberOfLine = 0
while True:
  response = ser.readline()
  print(response)
  numberOfLine = numberOfLine + 1
  if (numberOfLine >= 11):
     break
ser.close()

see: home-assistant/core#37349

- add image for ISKRA MT174
- add tx pin
- add interval trigger to send out data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants