Code Monkey home page Code Monkey logo

eva4's Issues

pubsub output - not working correctly without reporting interval

At the moment there are two options:

  1. use interval to send data every X seconds.
  2. realtime to send data as they are changed.

Which results in weird behavior for relays and other user-controllable modbus entities.
At startup, mqtt pusher does not send anything because no change is made and respective MQTT entity became unavailable, untill entity state changed (e.g. relay triggered). However, it cannot be changed because it is controlled by user, user cannot control entity because it is unavailable.

Expected behavior:

  1. All entities after startup/autocreation are marked as changed as in fact they are - they created.
  2. MQTT detects those entities are changed and pushes data to the broker.

Some side thoughts.
The output missing a throttling behaviour, which means : it should send data at most the interval seconds. E.g. if data changes too often, without interval the broker will be flooded. But if data changex rarely - they should be sent as soon as they changed.

For example:
FAN RPM: changes every 1 seconds, with interval 30 seconds the data will be sent at most every 30 seconds.
Relay state: the confirmation must be sent as soon as it changes. If relay changes it's state, it is weird to wait 30 seconds for getting confirmation from the mobdus (but we must wait because interval is 30 seconds).

Combining above and summing the FRQ:

  1. All pubsub entities must be reported at startup or in X seconds after startup.
  2. There should be throttling mechanism for spammy sensors, which adopts to entities like relays, which are not spammy and require immediate response to pubsub.

excessive timestamps in logs for docker environment

Docker logs maintains timestamps.
Eva logs with timestamps no matter wether it runs in docker or not.
Such behavior result in excessive timestamp information in docker logs, which is not necessary.

Issuing the following command, note the -t swich which turns on timestamp display.
docker logs -t addon_local_eva_ics 2>&1 | less
will result in double log timestamps :

2024-02-23T09:03:00.849643126Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] parsing environment variables
2024-02-23T09:03:00.849701848Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] reading the deployment file /mnt/init/init-99-discovery-service.yml
2024-02-23T09:03:00.849842543Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] parsing template tags
2024-02-23T09:03:00.849975321Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] parsing YAML structure
2024-02-23T09:03:00.850086937Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] extending
2024-02-23T09:03:00.850102950Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] parsing the payload
2024-02-23T09:03:00.850125833Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] analyzing upload
2024-02-23T09:03:00.850131951Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] connecting to /opt/eva4/var/bus.ipc
2024-02-23T09:03:00.851569139Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] local node: local-eva-ics
2024-02-23T09:03:00.851604425Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] testing node .local
2024-02-23T09:03:00.851995906Z [2024-02-23T09:03:00Z WARN  eva_cloud_manager::deploy] starting deployment
2024-02-23T09:03:00.852010650Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] deploying node .local
2024-02-23T09:03:00.852014724Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] deploying items
2024-02-23T09:03:00.852290635Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::core local item created: lmacro:eva.macro.discovery/discovery
2024-02-23T09:03:00.866045984Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] deploying services
2024-02-23T09:03:00.866324836Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svcmgr deploying service eva.controller.py
2024-02-23T09:03:00.876250089Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svcmgr deploying service eva.controller.discovery
2024-02-23T09:03:00.881881268Z [2024-02-23T09:03:00Z INFO  eva_cloud_manager::deploy] waiting services start
2024-02-23T09:03:00.888748036Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svc eva.controller.discovery Logic Manager programmable controller started (eva.controller.discovery)
2024-02-23T09:03:00.888934023Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svc eva.controller.discovery starting cycle cycle
2024-02-23T09:03:00.888951580Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svc eva.controller.discovery running cycle #cycle, interval: 10s
2024-02-23T09:03:00.890436619Z 2024-02-23T10:03:00+01:00 local-eva-ics  ERROR eva::actmgr action 522d4006-1be6-4264-9830-0646431a6426 for lmacro:eva.macro.discovery/discovery failed at launch: Bus client not registered
2024-02-23T09:03:00.890673858Z 2024-02-23T10:03:00+01:00 local-eva-ics  WARN eva::svc eva.controller.discovery cycle cycle error: lmacro/Some(String("timeout"))
2024-02-23T09:03:00.948673055Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svc eva.controller.py mod:__init__ fn:run th:MainThread :: dir: /opt/eva4/runtime/xc/py, pool_size: 50
2024-02-23T09:03:00.948717558Z 2024-02-23T10:03:00+01:00 local-eva-ics  INFO eva::svc eva.controller.py mod:__init__ fn:mark_ready th:MainThread :: Python macros runner started
2024-02-23T09:03:02.884460189Z [2024-02-23T09:03:02Z INFO  eva_cloud_manager] operation completed
2024-02-23T09:03:02.886343798Z Deployment completed
2024-02-23T09:03:39.098084179Z 2024-02-23T10:03:39+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:03:44.288378518Z 2024-02-23T10:03:44+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:03:49.478308465Z 2024-02-23T10:03:49+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:03:54.658975540Z 2024-02-23T10:03:54+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:03:59.849283290Z 2024-02-23T10:03:59+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:04:05.028777079Z 2024-02-23T10:04:05+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out
2024-02-23T09:04:10.219068817Z 2024-02-23T10:04:10+01:00 local-eva-ics  ERROR eva::svc eva.controller.controller1 block pull failed for i1 / 2: Timed out

Unknown timezone when using eva console

Steps to reproduce:

(venv) root@local-eva-ics:/# export TZ=Asia/Riyadh && eva
Traceback (most recent call last):
  File "/opt/eva4/venv/bin/eva", line 3, in <module>
    import eva4_shell.shell as shell
  File "/opt/eva4/venv/lib/python3.8/site-packages/eva4_shell/shell.py", line 5, in <module>
    from .sharedobj import common, current_command
  File "/opt/eva4/venv/lib/python3.8/site-packages/eva4_shell/sharedobj.py", line 14, in <module>
    TZ=pytz.timezone(time.tzname[0]))
  File "/opt/eva4/venv/lib/python3.8/site-packages/pytz/__init__.py", line 188, in timezone
    raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: '+03'

Expected result: console working properly.

question

Hello. Thanks for a wonderful product. I haven't used it in a production environment yet. However, I would like to know if there are plans to create an SDK in other languages. For example, dart or golang.

eva4-svc-controller-py do not honor absolute path

Service config:

  - id: eva.controller.py
    params:
      command: venv/bin/eva4-svc-controller-py
      bus:
        path: var/bus.ipc
      config:
        macro_dir: /homeassistant/addons/eva_ics
      user: nobody

Expected result:
controller looks for macros using absolute paths.

Result:
controller appends path to the default one:

  File "/opt/eva4/venv/lib/python3.8/site-packages/eva4_controller_py/__init__.py", line 113, in safe_run_macro
    run_macro(i, args, kwargs, timeout, env)
  File "/opt/eva4/venv/lib/python3.8/site-packages/eva4_controller_py/__init__.py", line 86, in run_macro
    code = compiler.compile(fname)
  File "/opt/eva4/venv/lib/python3.8/site-packages/eva4_controller_py/__init__.py", line 43, in compile
    mtime = os.path.getmtime(fname)
  File "/usr/lib/python3.8/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/opt/eva4/runtime//homeassistant/addons/eva_ics/room1.fan_control.py'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.