You should send a command instead of posting an update. This will only change the state of your items. Replace postUpdate with sendCommand and you should be fine
Hi @DrRSatzteil, just a quick follow up to our āIndicator discussionā from November:
Iāve updated OH from 4.0.1 to 4.1.1 today and also replaced the jar file with the current version 1.0. Everything regarding the Awtrix light binding is working, and Iām already using the (de)activateIndicator
actions in my rules. Works like a charm.
The problem that I saw so many āIndicator updatedā logs is also gone. I manually edited the log4j2.xml file which prevented a config update to hide the āupdatedā logs from being applied. After defining the necessary entries in the log4j2.xml for āItemStateUpdateEventā and āGroupStateUpdateEventā, my log files donāt show any update events anymore. This doesnāt mean that the binding does not send these updates, they just donāt show up in the log (which is the default if you donāt mess with your log4j2.xml )
I just love how the clock displays some interesting information from my Smart Home
The installation via marketplace fails at the moment.
Thank you for reporting this. Iām sorry but I donāt know what I did wrong in my first post. I double checked the template but maybe I misunderstood something in the description?! Could this be a problem with Dropbox?
Might anybody assist here please
Any idea what I am doing wrong ?
Install via Marketplace still fails but even manual install (by putting the *.jar in /usr/share/openhab/addons) doesnāt do the trick.
I have the light up and running and I am eager to get it openhabād
Could you describe in detail what happens when you drop the file? Have you set proper permissions on the jar file? Do you have anything in the logs?
When I drop the file, nothing happens.
My OH logs are empty.
The current permissions are
Changing it to openhab:openhab didnāt make a difference.
Any ideas what Iām doing wrong ?
you can try to move the file to a different location and change the file ownership:
chown openhab:openhab NAMEOFJARFILE
Then move the file back into the addon folder. I hope this fixes your problem.
EDIT: sorry I saw that you already did that. portboy reported a similar problem a few posts earlier but somehow solved this. Maybe his approach could help you too?
One other thing: have you touched the file after changing the ownership? I would try that first
Iām confused.
It seems as if I got it installed
But I cannot add new things via the GUI, the binding does not appear
Edit: worked! had to reboot the clock
Edit2:
I have (of course) setup a Test app which only shows āhello worldā in rainbow colors.
This works fine.
Weirdly though i have the text āNEW AWTRIX APPā scrolling on the display, even if the only activated app is TIME.
Any idea what Iām missing ?
Have you sent a command to the text item that is connected to the channel? NEW AWTRIX APP is the default so for some reason your text did not make it through to the clock. Was your clock auto discovered?
Or did you create an app that you removed later without disabling it first? The apps are persisted as retained mqtt messages so the easiest way would be to recreate the app and disable it via the active channel and remove the thing again.
Could someone please provide me with the whole snipped on how to set the indicator color in JS? I am not able to get it workingā¦
Also, I added some app using the UI which I later removed in favor of file-based apps. Unfortunately, this first app is still active and showing the default āNew Awtrix Appā text. Any advice on how to remove this?
Update regarding the first issue:
const mqttActions = actions.get('mqtt.awtrixlight', 'mqtt:awtrixclock:awtrix:awtrix-clock');
mqttActions.activateIndicator(3, [255,0,0]);
For convenience I added items and a rule to handle the indicators like color lights:
rules.JSRule({
name: 'Awtrix: Handle indicator',
triggers: [
triggers.ItemCommandTrigger('Awtrix_Indicator_1'),
triggers.ItemCommandTrigger('Awtrix_Indicator_2'),
triggers.ItemCommandTrigger('Awtrix_Indicator_3')
],
execute: (event) => {
const id = parseInt(event.itemName.replace('Awtrix_Indicator_', ''), 10);
const mqttActions = actions.get('mqtt.awtrixlight', 'mqtt:awtrixclock:awtrix:awtrix-clock');
if (event.receivedCommand === 'OFF' || event.receivedCommand === '0') {
mqttActions.deactivateIndicator(id)
} else {
let colorCode = [255,0,0];
if (event.receivedCommand.includes(',')) {
const HSBToRGB = (h, s, b) => {
s /= 100;
b /= 100;
const k = (n) => (n + h / 60) % 6;
const f = (n) => b * (1 - s * Math.max(0, Math.min(k(n), 4 - k(n), 1)));
return [255 * f(5), 255 * f(3), 255 * f(1)].map((v) => parseInt(v.toString(), 10));
};
colorCode = HSBToRGB(...event.receivedCommand.split(',').map((v) => parseInt(v, 10)));
}
mqttActions.activateIndicator(id, colorCode);
}
},
});
Regarding the second issue with removing custom apps, one can use the Awtrix API directly. Just execute a POST with an empty body against /api/custom?name=<App name>
.
You were quicker to find out than me searching for example code. I paste it here nevertheless:
var rgb = [255,255,0];
var rgb2 = [0,255,255];
var rgb3 = [0,255,0];
awtrixactions = actions.thingActions("mqtt.awtrixlight", "mqtt:awtrixclock:a0e7f22d86:awtrix_1210f4");
awtrixactions.activateIndicator(1, rgb);
awtrixactions.blinkIndicator(2, rgb2, 500);
awtrixactions.fadeIndicator(3, rgb3, 500);
//awtrixactions.deactivateIndicator(1);
//awtrixactions.deactivateIndicator(2);
//awtrixactions.deactivateIndicator(3);
If you want to remove the app completely from within OH you can set the app to inactive (via a switch linked to the channel) before you delete the thing.
You can retrieve the colour components from an HSBType simpler like that:
hsbType.blue
hsbType.red
hsbType.green
Hi,
I am also starting to play around with this binding as I bought the clock as well.
I finally managed to add it through the UI, but as try to manage all of my things/items/rules via files, I was wondering if someone could help me with that.
I tried a few things, but no success. If someone could share a sample config for the .things file. I would then also suggest to put it in the documentation part as many other bindings doā¦
Thanks for all the work!
A short test revealed this:
Thing awtrixclock awtrix2 "Awtrix Schreibtisch" [
appLockTimeout=10,
discoverDefaultApps=false,
basetopic="awtrix",
lowBatteryThreshold=25
]
as child of an existing mqtt bridge. Channels are found by autoDiscovery (I did not check any further, but thing is indicated as online)
Hi, what actions are possible with this binding?
How can I check a binding for possible actions?
Greets.
Since I still havenāt found the time to write a documentation the easiest way would be to look at the code (if you are fine with that):
No guarantee that this works with all bindings though, they may have different package structures.
Thanks Udo!
Thanks for this.
I found some nice actions:
playSound(String melody)
showNotification(String message, String icon)
mabye this if I know how to use
showCustomNotification(Map<String, Object> appParams, boolean hold, boolean wakeUp, boolean stack, String rtttl, String sound, boolean loopSound)
But I dont get these actions to workā¦
Iām working with RulesDSL, so my rule looks as follows:
var awtrixactions = getActions("mqtt.awtrixlight", "mqtt:awtrixclock:mqttbroker:Awtrixlight")
logInfo("awtrixactions", awtrixactions.toString)
awtrixactions.showNotification ("Test","52499")
neither showNotification nor playSound (with file, or with melody) worksā¦ I always get
The method showNotification(String, String) is undefined for the type ThingActions;
or
The method playSound(Object) is undefined for the type ThingActions;
Loginfo: org.openhab.binding.mqtt.awtrixlight.internal.action.AwtrixActions@434f4249
Can you help me?
Greets
I just found this thread:
It seems that I need to adapt my code so that actions will also work via DSL. I wasnāt aware of that but will look into it. Unfortunately I cannot give you an estimate when I will manage to do this. So long it might be an option to switch to js scripting, I gave an example for notifications in one of my previous posts.
Ok thanks. Iām staying at rulesDSL. Iāll create my own mqtt things for notifications and playSound.
Greets