Push notification

Hello,

I try so send a push notification if the washmaschine finished to wash. I use a Homematic IP Switch and Meter Plug. I have the possibility to switch the plug manually on and off. But I don’t receive a message on the Openhab app, if the maschine was ready. I tried the following rule:

rule "push"
when
Item GF_LaundryRoom_Power_washmaschine_consume < 45.00
then
sendBroadcastNotification("Washmaschine ready ")
end

But I don’t will receive anything. I tried already with another value. But it’s the same result.

Thanks for support!

Please have a look into the logs if rules won’t work. You can’t put off clauses into the trigger.

Item GF_LaundryRoom_Power_washmaschine_consume changed

Then do an if clause in the then section

I have changed the rule. But it still not work.
I checked the log, but I will not find a line which this rules.

Can you show me a sample for this rule?

Thanks!

please post the rule - and have a immediate look into openhab.log after saving it. There must be some entry concerning the rule.

1 Like
rule "push"
when   
   Item GF_LaundryRoom_Power_Trockner_Verbrauch received update
then   
   If (GF_LaundryRoom_Power_Trockner < 45.00) {    
    sendBroadcastNotification("Trockner fertig ")}
end

In the Logs if found the following line:
Rule ‘push’: The name ‘If’ cannot be resolved to an item or type; line 5, column 4, length 42

That’s why you should always have a log in the logs! :wink:

please write if - no capital letters here! (same goes for else, elseif, switch and so on.)

ok, thanks!
I changed the rules now. But in the Log I get this line:

Refreshing model 'push.rules’
Configuration model ‘push.rules’ is either empty or cannot be parsed correctly!
Loading model ‘push.rules’

Do you think the rule is ok?

yes, that’s normal behaviour if you edit the file via smb or sftp. The first line is triggered as the file is touched (but empty), the second line is triggered as the file is written. If there’s no further notice (INFO or WARN or ERROR) after the last “loading model…” you’re safe! :wink:

That sounds great! :slight_smile:
I will test the next days and give a feedback…

Thank you for your support!!!

So i tried the rule now. But i don‘t received a Push notification.
Should i change the settings of the plug in the CCU2?

Thanks!

That’s probably dependent on two Things:

  1. the logic of your rules at all (if (GF_LaundryRoom_Power_Trockner.state < 45.00) {) - you have to have the “.state” Syntax!
  2. the logic of how you measure your washing machine or dryer
    just have a look here - it’s Sonoff-hardware, but the logic works for your homematic also:
    Washing Machine State Machine

So the rule is now updated, but it doesn’t run. I have the following entry in the log file:

Configuration model ‘push.rules’ has errors, therefore ignoring it: [3,4]: no viable alternative at input ‘.’ [11,4]: no viable alternative at input ‘.’

Configuration model ‘push.rules’ has errors, therefore ignoring it: [3,4]: no viable alternative at input ‘.’ [12,4]: no viable alternative at input ‘.’

just get rid of the .00 - you don’t need it anyways.

i canceled the 00, but I have the same lines in the log file.

I haven’t any Items with “.state” in the Items-list. Can this be the problem? I have only this one:

items

no. That’s completely different. Please have a look at the Basics of rules:

Please read through both and try to adapt to your rules.

tl>dr;
If you have an item, you can address it in a rule of Course. If you don’t add “.state” to that, you’ll get all the meta-data of that item (itemtype, last update, … AND the value). So, if you want to compare something to an item value you MUST add .value to it - But that’s explained in detail above.

I have the perfect rule now:

rule "<name>"
when   
   Item <Item name> changed
then
   if (<Item name>.state < <number>) {
    sendBroadcastNotification("<notice> ")}
end

Many thanks to binderth!!!

1 Like

Hi

I’ve tweaked this a tiny bit to also send the state of the rule’s trigger.

rule "<name>"
when   
   Item <Item name> changed
then
   if (<Item name>.state < <number>) {
    sendBroadcastNotification("<notice> "+ <Item name>.state)}
end

Would this also work with .value ? Etc