Skip to content

Commit

Permalink
release v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Feb 3, 2024
1 parent d80a29a commit c55e4d3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log

## v0.1.1 Bug Fix and values in log view
* 🐞 Missing function added from refactoring 🐞
* 💎 Added values for incoming messages which are displayed in log view.
29 changes: 29 additions & 0 deletions eo-man/data/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,35 @@ def update_device(self, device: Device) -> None:
self.app_bus.fire_event(AppBusEventType.UPDATE_SENSOR_REPRESENTATION, device)


def find_device_by_local_address(self, address:str, base_id:str) -> Device:
local_adr = int.from_bytes(AddressExpression.parse(address)[0], "big")
base_adr = int.from_bytes(AddressExpression.parse(base_id)[0], "big")

if (local_adr + base_adr) > 0xFFFFFFFF:
return None

ext_id = a2s(local_adr + base_adr)
if ext_id in self.devices:
return self.devices[ext_id]

return None


def get_values_from_message_to_string(self, message:EltakoMessage) -> str:
ext_id_str = b2s(message.address)
if ext_id_str in self.devices:
device = self.devices[ext_id_str]
try:
eep:EEP = EEP.find(device.eep)
properties_as_str = []
for k, v in eep.decode_message(message).__dict__.items():
properties_as_str.append(f"{str(k)[1:] if str(k).startswith('_') else str(k)}: {str(v)}")

return eep, ', '.join(properties_as_str)
except:
pass
return None, ''


def generate_ha_config(self) -> str:
ha_platforms = set([str(d.ha_platform) for d in self.devices.values() if d.ha_platform is not None])
Expand Down
10 changes: 8 additions & 2 deletions eo-man/view/log_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
from tkinter import ttk
import tkinter.scrolledtext as ScrolledText
from data.data_helper import b2s, a2s
from data.data_manager import DataManager
from eltakobus.message import EltakoPoll, EltakoDiscoveryReply, EltakoDiscoveryRequest, EltakoMessage, prettify, Regular1BSMessage, EltakoWrapped1BS

from controller.app_bus import AppBus, AppBusEventType

class LogOutputPanel():

def __init__(self, main: Tk, app_bus:AppBus):
def __init__(self, main: Tk, app_bus:AppBus, data_manager:DataManager):
self.app_bus = app_bus
self.data_manager = data_manager

pane = ttk.Frame(main, padding=2, height=100)
# pane.grid(row=2, column=0, sticky="nsew", columnspan=3)
Expand Down Expand Up @@ -44,7 +46,11 @@ def serial_callback(self, data:dict):
if hasattr(telegram, 'status'):
payload += ', status: '+ a2s(telegram.status, 1)

self.receive_log_message({'msg': f"Received Telegram: {tt} from {adr}{payload}", 'color': 'darkgrey'})
eep, values = self.data_manager.get_values_from_message_to_string(telegram)
if eep is not None:
values = f" => values for EEP {eep.__name__}: ({values})"

self.receive_log_message({'msg': f"Received Telegram: {tt} from {adr}{payload}{values}", 'color': 'darkgrey'})


def receive_log_message(self, data):
Expand Down
2 changes: 1 addition & 1 deletion eo-man/view/main_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, main: Tk, app_bus:AppBus, data_manager: DataManager):

dt = DeviceTable(data_split_area, app_bus, data_manager)
dd = DeviceDetails(data_split_area, app_bus, data_manager)
lo = LogOutputPanel(main_split_area, app_bus)
lo = LogOutputPanel(main_split_area, app_bus, data_manager)

main_split_area.add(data_split_area, weight=5)
main_split_area.add(lo.root, weight=1)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name='eo-man',
version='0.1',
version='0.1.1',
package_dir={'':"eo-man"},
# packages=find_packages("./eo-man"),
package=['view', 'data', 'controller', 'icons'],
Expand Down

0 comments on commit c55e4d3

Please sign in to comment.