Skip to content

Commit

Permalink
Version 0.1.26
Browse files Browse the repository at this point in the history
- Latest enocean-mqtt version which fixes status bits setting (see #65 and embyt/enocean-mqtt#41 for more details)
- From now, use mak-gitdev/enocean as Python EnOcean Library which fixes "list index out of range error" thanks to @kridgo patch (see kipe/enocean#134 and kipe/enocean#138 for more details).
- Add virtual A5-10-06 (#46)
- Add '%' as unit of measurement for A5-20-01 current value field (#53)
- Update F6-02-[01-02] mapping to send status bits thanks to @LarsKoeppel.
  • Loading branch information
mak-gitdev committed Jun 5, 2023
1 parent d77b4b8 commit 6947e09
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 8 deletions.
3 changes: 3 additions & 0 deletions enoceanmqtt/communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@ def _send_packet(self, sensor, destination, command=None,
if 'data' in sensor:
# override with specific data settings
logging.debug("sensor data: %s", sensor['data'])
# Set packet data payload
packet.set_eep(sensor['data'])
# Set packet status bits
packet.data[-1] = packet.status
packet.parse_eep() # ensure that the logging output of packet is updated
else:
# what to do if we have no data to send yet?
Expand Down
53 changes: 47 additions & 6 deletions enoceanmqtt/overlays/homeassistant/mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,46 @@
state_topic: ""
value_template: >-
{% if value_json.SLSW == 1 %}OFF{% else %}ON{% endif %}
virtual:
- component: "number"
name: "setpoint"
config:
command_topic: "__trash"
min: "0"
max: "255"
step: "1"
mode: "box"
- component: "number"
name: "temperature"
config:
command_topic: "__trash"
min: "0"
max: "40"
step: "0.1"
mode: "box"
unit_of_measurement: "°C"
icon: "mdi:thermometer"
- component: "switch"
name: "slide_switch"
config:
command_topic: "__trash"
- component: "button"
name: "send"
config:
command_topic: "req"
command_template: >-
{% set ns = namespace() %}
{% for entity in device_entities(device_id(entity_id)) %}
{% if entity is search('_slide_switch$',ignorecase=True) %}
{% if is_state(entity, "on") %}{% set ns.SLSW = 1 %}{% else %}{% set ns.SLSW = 0 %}{% endif %}
{% elif entity is search('_setpoint$',ignorecase=True) %}
{% set ns.SP = (states(entity)|int)|int(default=128) %}
{% elif entity is search('_temperature$',ignorecase=True) %}
{% set ns.TMP = (40-(states(entity)|float(default=20))*255/40)|int %}
{% endif %}
{% endfor %}
{"SP":"{{ns.SP}}","TMP":"{{ns.TMP}}","SLSW":"{{ns.SLSW}}","send":"clear"}
icon: "mdi:send"
0x10:
device_config:
command: ""
Expand Down Expand Up @@ -2568,6 +2608,7 @@
state_topic: ""
value_template: "{{ value_json.CV }}"
device_class: "power_factor"
unit_of_measurement: "%"
icon: "mdi:valve"
- component: "binary_sensor"
name: "SO"
Expand Down Expand Up @@ -2885,12 +2926,12 @@
- "BI + AI"
command_topic: "req"
command_template: >-
{% set R1, EB, R2, SA = 0, 0, 0, 0 %}
{% set R1, EB, R2, SA, T21, NU = 0, 0, 0, 0, 1, 0 %}
{% set id = {"AI":"0","AO":"1","BI":"2","BO":"3"} %}
{% set action = value.split(" + ") %}
{% if value is not search('None') %}{% set EB, R1 = 1, id[action[0]] %}{% endif %}
{% if value is not search('None') %}{% set EB, NU, R1 = 1, 1, id[action[0]] %}{% endif %}
{% if action|length==2 %}{% set SA, R2 = 1, id[action[1]] %}{% endif %}
{"R1":{{R1}},"EB":{{EB}},"R2":{{R2}},"SA":{{SA}},"send":"clear"}
{"R1":{{R1}},"EB":{{EB}},"R2":{{R2}},"SA":{{SA}},"T21":{{T21}},"NU":{{NU}},"send":"clear"}
0x02:
device_config:
command: ""
Expand Down Expand Up @@ -2958,12 +2999,12 @@
- "BI + AI"
command_topic: "req"
command_template: >-
{% set R1, EB, R2, SA = 0, 0, 0, 0 %}
{% set R1, EB, R2, SA, T21, NU = 0, 0, 0, 0, 1, 0 %}
{% set id = {"AI":"0","AO":"1","BI":"2","BO":"3"} %}
{% set action = value.split(" + ") %}
{% if value is not search('None') %}{% set EB, R1 = 1, id[action[0]] %}{% endif %}
{% if value is not search('None') %}{% set EB, NU, R1 = 1, 1, id[action[0]] %}{% endif %}
{% if action|length==2 %}{% set SA, R2 = 1, id[action[1]] %}{% endif %}
{"R1":{{R1}},"EB":{{EB}},"R2":{{R2}},"SA":{{SA}},"send":"clear"}
{"R1":{{R1}},"EB":{{EB}},"R2":{{R2}},"SA":{{SA}},"T21":{{T21}},"NU":{{NU}},"send":"clear"}
0x05:
0x02:
device_config:
Expand Down
13 changes: 11 additions & 2 deletions standalone/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ usage ()

package_install()
{
printf "\nCheck if %s is installed ... " $1
printf "\nInstall %s\n" $1
printf "==================================================\n\n"
printf "\nCheck if %s is already installed ... " $1
pip3 show $1 > /dev/null 2>&1
if [ $? -eq 1 ]; then
printf "NO\n"
Expand All @@ -31,6 +33,7 @@ package_install()

if [ $# -eq 0 ]; then
usage
exit 0
fi

CALL_DIR=$(pwd)
Expand All @@ -52,9 +55,16 @@ cd ${INSTALL_DIR}

package_install pyyaml
package_install tinydb
package_install pip-autoremove

printf "\nInstall Python EnOcean Library\n"
printf "==================================================\n\n"
pip-autoremove enocean -y
pip3 install --user git+https://github.com/mak-gitdev/enocean.git

printf "\nClone enocean-mqtt\n"
printf "==================================================\n\n"
rm -rf enocean-mqtt
git clone https://github.com/embyt/enocean-mqtt.git

printf "\nInstall enocean-mqtt\n"
Expand All @@ -71,7 +81,6 @@ else
git clone -b master --single-branch --depth 1 https://github.com/mak-gitdev/HA_enoceanmqtt.git
fi
cp -rf HA_enoceanmqtt/enoceanmqtt enocean-mqtt
cp -rf HA_enoceanmqtt/enocean/protocol/EEP.xml $(find / -path ./HA_enoceanmqtt -prune -o -name "EEP.xml" -print -quit 2>/dev/null)
rm -rf HA_enoceanmqtt

cd ${CALL_DIR}

0 comments on commit 6947e09

Please sign in to comment.